.crm-body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7f4;
  color: #151816;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.crm-shell {
  min-height: 100vh;
}

.crm-login {
  width: min(420px, calc(100% - 32px));
  margin: 72px auto;
  padding: 24px;
  border: 1px solid #d7ddd5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(21, 24, 22, 0.08);
}

.crm-login h1,
.crm-header h1,
.crm-detail-head h2,
.crm-panel-head h2,
.crm-panel-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.crm-kicker {
  margin: 0 0 6px;
  color: #26706a;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.crm-muted {
  margin: 0;
  color: #66716b;
  font-size: 0.88rem;
}

.crm-app {
  padding: 20px;
}

.hidden {
  display: none !important;
}

.crm-header,
.crm-toolbar,
.crm-list-panel,
.crm-detail-panel {
  border: 1px solid #d7ddd5;
  border-radius: 8px;
  background: #ffffff;
}

.crm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.crm-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px 180px auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
}

.crm-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.crm-list-panel,
.crm-detail-panel {
  min-height: calc(100vh - 178px);
  overflow: hidden;
}

.crm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e4e8e1;
}

.crm-lead-list {
  max-height: calc(100vh - 234px);
  overflow: auto;
}

.crm-lead-row {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid #e4e8e1;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.crm-lead-row:hover,
.crm-lead-row.active {
  background: #eef5f2;
}

.crm-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crm-row-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crm-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #bfcac2;
  border-radius: 999px;
  background: #f8faf7;
  color: #405249;
  font-size: 0.76rem;
  font-weight: 700;
}

.crm-detail-panel {
  padding: 0;
}

.crm-empty {
  padding: 32px;
  color: #66716b;
}

#lead-detail {
  padding: 18px;
}

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

.crm-edit-grid {
  display: grid;
  grid-template-columns: 180px 120px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #e4e8e1;
  border-radius: 8px;
  background: #fbfcfa;
}

.crm-wide {
  grid-column: span 3;
}

.crm-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  margin-top: 14px;
}

.crm-split > section {
  border: 1px solid #e4e8e1;
  border-radius: 8px;
  overflow: hidden;
}

.crm-messages,
.crm-notifications {
  max-height: 460px;
  overflow: auto;
  padding: 14px;
}

.crm-message {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0f3ee;
}

.crm-message.outbound {
  margin-left: 44px;
  background: #e7f3ef;
}

.crm-message.inbound {
  margin-right: 44px;
  background: #f6f1e8;
}

.crm-message-meta,
.crm-note {
  margin-top: 5px;
  color: #66716b;
  font-size: 0.78rem;
}

.crm-form {
  display: grid;
  gap: 12px;
}

.crm-split .crm-form {
  padding: 14px;
}

.crm-notification-head {
  border-top: 1px solid #e4e8e1;
}

.crm-notification {
  padding: 10px 0;
  border-bottom: 1px solid #e4e8e1;
}

label {
  display: grid;
  gap: 6px;
  color: #405249;
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c7d0c8;
  border-radius: 7px;
  background: #ffffff;
  color: #151816;
  font: inherit;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 7px;
  background: #1f6f68;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.crm-link {
  color: #26706a;
  font-size: 0.88rem;
  font-weight: 700;
}

.crm-secondary {
  border: 1px solid #bfcac2;
  background: #ffffff;
  color: #1f6f68;
}

.crm-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
}

.crm-error {
  min-height: 20px;
  margin: 0;
  color: #a23b2a;
  font-size: 0.86rem;
}

#login-panel {
  display: grid;
  gap: 16px;
}

@media (max-width: 980px) {
  .crm-toolbar,
  .crm-grid,
  .crm-split,
  .crm-edit-grid {
    grid-template-columns: 1fr;
  }

  .crm-wide {
    grid-column: auto;
  }

  .crm-list-panel,
  .crm-detail-panel {
    min-height: auto;
  }

  .crm-lead-list,
  .crm-messages,
  .crm-notifications {
    max-height: none;
  }
}
