.crm-profile-head {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.crm-toolbar input[type="search"] {
  width: min(520px, 100%);
}

.crm-customer-head {
  display: grid;
  gap: 14px;
}

.crm-segment-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.crm-segment-btn span {
  color: var(--muted);
  font-weight: 800;
  margin-left: 6px;
}

.crm-segment-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: light-dark(rgba(124, 58, 237, 0.08), rgba(129, 140, 248, 0.14));
}

.crm-customer-toolbar {
  margin-bottom: 0;
}

.crm-customer-stats {
  margin-bottom: 18px;
}

.crm-anchor-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.crm-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: transparent;
  border: 0;
}

.crm-field {
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: light-dark(rgba(255, 255, 255, 0.5), rgba(15, 23, 42, 0.4));
  transition: var(--transition-fast);
}

.crm-field:hover {
  border-color: var(--primary);
  background: light-dark(rgba(99, 102, 241, 0.02), rgba(255, 255, 255, 0.02));
}

.crm-field.wide {
  grid-column: span 2;
}

.crm-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.crm-field strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.crm-record-list {
  display: grid;
  gap: 18px;
}

.crm-record {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.crm-record:first-child {
  padding-top: 0;
  border-top: 0;
}

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

.crm-record-head strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.crm-record-amount {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.crm-record-amount strong {
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.crm-record-amount span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.crm-subtitle {
  margin: 18px 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.crm-subtable {
  min-width: 760px;
}

.crm-subtable-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.crm-followup-list {
  border-top: 1px solid var(--line);
}

.crm-followup-item {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 2fr);
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.crm-followup-head {
  display: flex;
  align-items: center;
  align-content: flex-start;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.crm-followup-head time {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-followup-head strong {
  color: var(--ink);
  font-size: 13px;
}

.crm-followup-head .pill {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11px;
}

.crm-followup-next {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
}

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

.crm-followup-content > p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.crm-followup-more {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.crm-followup-more > summary {
  width: max-content;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.crm-followup-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 10px 0 0;
}

.crm-followup-meta > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.crm-followup-meta dt {
  color: var(--muted);
}

.crm-followup-meta dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.attachment-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: light-dark(#fff, rgba(255, 255, 255, 0.01));
  overflow: hidden;
  transition: var(--transition-fast);
}

.attachment-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.attachment-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 132px;
  border-bottom: 1px solid var(--line);
  background: light-dark(#f8fafc, rgba(15, 23, 42, 0.4));
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 8px var(--primary-glow);
}

.attachment-icon svg {
  width: 24px;
  height: 24px;
}

.attachment-meta {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.attachment-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
}

.attachment-meta span,
.attachment-meta a {
  font-size: 11px;
}

.attachment-meta a {
  color: var(--primary);
  font-weight: 700;
}

.attachment-meta a:hover {
  text-decoration: underline;
}

.attachment-details {
  margin: 0 12px 12px;
}

.raw-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: light-dark(#fff, rgba(15, 23, 42, 0.2));
  overflow: hidden;
}

.raw-details summary {
  min-height: 38px;
  padding: 12px 16px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: light-dark(#f8fafc, rgba(15, 23, 42, 0.4));
  transition: var(--transition-fast);
}

.raw-details summary:hover {
  background: light-dark(#f1f5f9, rgba(15, 23, 42, 0.6));
}

.raw-table-wrap {
  max-height: 360px;
  border-top: 1px solid var(--line);
  overflow: auto;
}

.raw-table {
  min-width: 720px;
  margin: 0;
}

.raw-table td:last-child {
  min-width: 320px;
  overflow-wrap: anywhere;
}

.raw-json-details {
  border-top: 1px solid var(--line);
}

.raw-json {
  overflow: auto;
  max-height: 520px;
  margin: 0;
  padding: 16px;
  color: light-dark(#24292f, #e6edf3);
  background: light-dark(#f6f8fa, #0d1117);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.slim-empty {
  padding: 14px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}
