.crm-page-box {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.crm-page-title-box .page-title h1 {
  color: #00283c;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
}

.crm-back-link {
  display: inline-block;
  color: #00283cb2;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  margin-bottom: 8px;
}

.crm-back-link:hover {
  color: #00283c;
}

/* Pending questions notice */

.crm-pending-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e1;
  border: 1px solid #ffd91a;
  border-radius: 8px;
  padding: 12px 16px;
  color: #00283c;
  font-size: 14px;
}

.crm-pending-notice-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ffd91a;
  color: #00283c;
  font-size: 12px;
  font-weight: 700;
}

/* Navbar count badge */

.navbar-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #ffd91a;
  color: #00283c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* Filters */

.crm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.crm-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.crm-filter-label {
  color: #00283cb2;
  font-size: 13px;
  font-weight: 700;
}

.crm-filter-select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #dce6ea;
  border-radius: 8px;
  background: white;
  color: #00283c;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.crm-filter-select:focus {
  outline: none;
  border-color: #7cc8d9;
}

/* Leads table */

.crm-leads-table-wrapper {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 100px #00283c2b;
  padding: 8px 24px;
  overflow-x: auto;
}

.crm-leads-table {
  width: 100%;
  /* Lay columns out at natural width on narrow screens so the wrapper
     scrolls horizontally instead of crushing cells. */
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
  color: #00283c;
}

.crm-leads-table th {
  text-align: left;
  padding: 16px 12px;
  color: #00283cb2;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 1px solid #dce6ea;
}

.crm-leads-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #eef4f6;
  vertical-align: middle;
}

.crm-leads-table tbody tr:last-child td {
  border-bottom: none;
}

.crm-contact-link {
  color: #00283c;
  font-weight: 700;
  text-decoration: none;
}

.crm-contact-link:hover {
  text-decoration: underline;
}

.crm-lead-listing {
  max-width: 260px;
}

.crm-lead-activity {
  white-space: nowrap;
  color: #00283cb2;
}

/* Badges */

.crm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-badge--low {
  background: #eef4f6;
  color: #00283cb2;
}

.crm-badge--medium {
  background: #fff8e1;
  color: #8a6d00;
}

.crm-badge--high {
  background: #e7f6ec;
  color: #1e7b3c;
}

.crm-badge--empty {
  background: transparent;
  color: #00283c66;
}

.crm-badge--status-new {
  background: #eaf7fa;
  color: #00283c;
}

.crm-badge--status-contacted,
.crm-badge--status-viewing {
  background: #fff8e1;
  color: #8a6d00;
}

.crm-badge--status-negotiation {
  background: #fdeee0;
  color: #a05a1c;
}

.crm-badge--status-won {
  background: #e7f6ec;
  color: #1e7b3c;
}

.crm-badge--status-lost {
  background: #fff5f5;
  color: #cd5252;
}

.crm-channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eef4f6;
  color: #00283c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-channel-badge--email {
  background: #eaf7fa;
}

.crm-channel-badge--call {
  background: #e7f6ec;
}

.crm-channel-badge--sms {
  background: #fff8e1;
}

.crm-channel-badge--note {
  background: #f2eefa;
}

/* Status select */

.crm-status-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #dce6ea;
  border-radius: 8px;
  background: white;
  color: #00283c;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.crm-status-select:focus {
  outline: none;
  border-color: #7cc8d9;
}

.crm-status-select--won {
  border-color: #1e7b3c;
  color: #1e7b3c;
}

.crm-status-select--lost {
  border-color: #cd5252;
  color: #cd5252;
}

/* Empty state */

.crm-empty-state {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 100px #00283c2b;
  padding: 48px 40px;
  text-align: center;
  color: #00283cb2;
  font-size: 16px;
}

/* Contact card */

.crm-contact-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 100px #00283c2b;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.crm-section-title {
  color: #00283c;
  font-size: 20px;
  font-weight: 700;
}

.crm-section-subtitle {
  color: #00283cb2;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.crm-contact-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
}

.crm-contact-field dt {
  color: #00283cb2;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.crm-contact-field dd {
  color: #00283c;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.crm-contact-field dd a {
  color: #00283c;
}

.crm-contact-field--wide {
  flex-basis: 100%;
}

.crm-lead-chips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.crm-lead-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid #dce6ea;
  border-radius: 8px;
  padding: 10px 14px;
}

.crm-lead-chip-address {
  color: #00283c;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Timeline */

.crm-timeline-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crm-note-form {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 100px #00283c2b;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-note-textarea {
  width: 100%;
  border: 1px solid #dce6ea;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: #00283c;
  resize: vertical;
}

.crm-note-textarea:focus {
  outline: none;
  border-color: #7cc8d9;
}

.crm-note-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Long option text (listing addresses) must not widen the select past the card. */
.crm-note-form-actions .crm-filter-select {
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
}

.crm-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-timeline-empty {
  color: #00283cb2;
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

.crm-timeline-item {
  background: white;
  border-radius: 12px;
  border: 1px solid #dce6ea;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.crm-direction {
  color: #00283cb2;
  font-size: 16px;
  font-weight: 700;
}

.crm-timeline-item-listing {
  color: #00283cb2;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.crm-timeline-item-date {
  margin-left: auto;
  color: #00283c66;
  font-size: 13px;
  white-space: nowrap;
}

.crm-timeline-item-summary {
  color: #00283c;
  font-size: 14px;
  font-weight: 700;
}

.crm-timeline-item-body p {
  color: #00283cb2;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.crm-timeline-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-top: 4px;
  color: #52b8cd;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.crm-timeline-toggle:hover {
  text-decoration: underline;
}

/* Questions inbox */

.crm-pending-notice-link {
  margin-left: auto;
  color: #00283c;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-question-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-question-group-title {
  color: #00283c;
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.crm-question-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-question-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #dce6ea;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-question-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.crm-question-text {
  flex: 1;
  min-width: 0;
  color: #00283c;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.crm-question-date {
  margin-left: auto;
  color: #00283c66;
  font-size: 13px;
  white-space: nowrap;
}

.crm-question-contact {
  color: #52b8cd;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.crm-question-contact:hover {
  text-decoration: underline;
}

.crm-question-answer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-question-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.crm-question-dismiss-btn {
  background: none;
  border: none;
  padding: 0;
  color: #00283cb2;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.crm-question-dismiss-btn:hover {
  color: #cd5252;
}

.crm-question-answered {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.crm-question-answer {
  color: #00283cb2;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Answered questions reference list */

.crm-answered-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-answered-toggle {
  background: none;
  border: none;
  padding: 0;
  align-self: flex-start;
  color: #00283cb2;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.crm-answered-toggle:hover {
  color: #00283c;
}

.crm-answered-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-answered-item {
  background: white;
  border-radius: 12px;
  border: 1px solid #eef4f6;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-answered-question {
  color: #00283c;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.crm-answered-answer {
  color: #00283cb2;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.crm-answered-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #00283c66;
  font-size: 13px;
}

/* Contact merge */

.crm-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.crm-merge-toggle-btn {
  background: white;
  border: 1px solid #dce6ea;
  border-radius: 8px;
  padding: 8px 16px;
  color: #00283c;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.crm-merge-toggle-btn:hover {
  border-color: #7cc8d9;
}

.crm-merge-panel {
  border: 1px solid #dce6ea;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-merge-hint {
  color: #00283cb2;
  font-size: 14px;
  line-height: 1.5;
}

.crm-merge-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.crm-merge-candidates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.crm-merge-candidate label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid #eef4f6;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.crm-merge-candidate label:hover {
  border-color: #7cc8d9;
}

.crm-merge-candidate-name {
  color: #00283c;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.crm-merge-candidate-meta {
  color: #00283cb2;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.crm-merge-actions {
  display: flex;
  justify-content: flex-end;
}

.crm-merge-empty {
  color: #00283cb2;
  font-size: 14px;
}

@media screen and (max-width: 768px) {
  .crm-page-title-box .page-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .crm-contact-card,
  .crm-note-form {
    padding: 20px;
  }

  .crm-leads-table-wrapper {
    padding: 4px 12px;
  }

  .crm-question-card,
  .crm-merge-panel {
    padding: 14px 16px;
  }

  /* Deterministic 2-column grid so fields don't wrap unevenly based on value lengths */
  .crm-contact-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  .crm-contact-field--wide {
    grid-column: 1 / -1;
  }
}

.crm-question-hint {
  color: #00283c66;
  font-size: 12px;
}
