.customer-safety {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #cfe2d8;
  border-radius: 14px;
  background: linear-gradient(135deg, #f1f8f4, #fff);
}

.customer-safety > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #d9eee3;
  color: #126a43;
  font-weight: 800;
}

.customer-safety strong { color: #183d2f; font-size: 13px; }
.customer-safety p { margin: 3px 0 0; color: #5c6e66; font-size: 11px; line-height: 1.5; }
.customer-create-panel { margin: 0 0 18px; border-top: 3px solid var(--green); }
.customer-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.customer-form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.customer-form-grid .customer-form-wide { grid-column: 1 / -1; }
.customer-form-grid input,
.customer-form-grid textarea { width: 100%; }

.customer-dashboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.customer-metric {
  min-height: 82px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--white);
  box-shadow: 0 3px 12px rgba(25, 52, 42, .035);
}

.customer-metric span { display: block; color: #75827d; font-size: 10px; font-weight: 700; }
.customer-metric strong { display: block; margin-top: 7px; color: #153f30; font-size: 22px; line-height: 1; }
.customer-metric.featured { border-color: #b9dacb; background: linear-gradient(135deg, #eff8f3, #fff); }

.customer-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 10px 16px;
  align-items: end;
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.customer-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #ccd7d1;
  border-radius: 10px;
  background: #fafcfb;
}

.customer-search span { color: #638074; font-size: 18px; }
.customer-search input { width: 100%; border: 0; outline: 0; background: transparent; }
.customer-filter-row { display: flex; gap: 9px; }
.customer-filter-row label { display: grid; gap: 4px; color: #697870; font-size: 10px; font-weight: 700; }
.customer-filter-row select { min-width: 142px; }
.customer-toolbar-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; min-height: 18px; }

.customer-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  padding-bottom: 24px;
}

.customer-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid #d8e1dc;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(24, 53, 42, .045);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.customer-card:hover { transform: translateY(-1px); border-color: #a9ccb9; box-shadow: 0 9px 22px rgba(24, 53, 42, .08); }
.customer-card-main { flex: 1; padding: 18px; }
.customer-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.customer-card-identity { display: flex; gap: 11px; min-width: 0; }
.customer-avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 13px; background: linear-gradient(135deg, #dcefe5, #f2f8f5); color: #176444; font-weight: 800; }
.customer-card h4 { margin: 1px 0 4px; overflow: hidden; color: #17382d; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-contact { color: #66766f; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.customer-state { padding: 4px 8px; border-radius: 999px; background: #e2f1e9; color: #176744; font-size: 9px; font-weight: 800; white-space: nowrap; }
.customer-state.inactive { background: #efefec; color: #6f746f; }

.customer-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 18px 0 14px; }
.customer-card-stat { padding: 10px; border-radius: 10px; background: #f6f8f7; }
.customer-card-stat span { display: block; color: #7a8680; font-size: 9px; }
.customer-card-stat strong { display: block; margin-top: 3px; color: #27473a; font-size: 14px; }
.customer-ai-preview { min-height: 42px; margin: 0; color: #52665d; font-size: 11px; line-height: 1.6; }
.customer-ai-preview.empty { color: #8a948f; }
.customer-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid #e8ecea; background: #fbfcfb; }
.customer-card-foot small { color: #829089; font-size: 9px; }
.customer-card-foot button { padding: 7px 10px; font-size: 10px; }
.customer-loading,
.customer-empty { grid-column: 1 / -1; padding: 56px 20px; border: 1px dashed #ccd6d1; border-radius: 15px; color: #738078; text-align: center; background: #fafbfa; }

.customer-drawer { width: min(720px, 94vw); }
.customer-drawer-body { padding-bottom: 80px; }
.customer-detail-hero { padding: 18px; border: 1px solid #d6e3dc; border-radius: 15px; background: linear-gradient(135deg, #f0f8f4, #fff); }
.customer-detail-title { display: flex; align-items: center; gap: 12px; }
.customer-detail-title .customer-avatar { width: 46px; height: 46px; font-size: 17px; }
.customer-detail-title h3 { margin: 0 0 4px; color: #153b2d; font-size: 18px; }
.customer-detail-title p { margin: 0; color: #67776f; font-size: 11px; }
.customer-detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 15px; }
.customer-detail-metrics span { padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, .78); color: #748078; font-size: 9px; }
.customer-detail-metrics strong { display: block; margin-top: 3px; color: #204537; font-size: 13px; }

.customer-ai-box { margin-top: 14px; padding: 16px; border: 1px solid #d3e2da; border-radius: 14px; background: #f8fbf9; }
.customer-ai-box-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.customer-ai-box-head strong { color: #1d4938; font-size: 12px; }
.customer-ai-box-head button { padding: 7px 10px; font-size: 10px; }
.customer-ai-box p { margin: 10px 0 0; color: #40564c; font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.customer-next-action { margin-top: 10px; padding: 10px 12px; border-left: 3px solid #2b9563; border-radius: 8px; background: #edf7f1; color: #23543f; font-size: 11px; }
.customer-ai-running { display: inline-flex; align-items: center; gap: 7px; color: #29734f; }
.customer-ai-running::before { content: ''; width: 11px; height: 11px; border: 2px solid #b8daca; border-top-color: #27895b; border-radius: 50%; animation: customer-spin .8s linear infinite; }
@keyframes customer-spin { to { transform: rotate(360deg); } }

.customer-detail-section { margin-top: 17px; }
.customer-detail-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.customer-detail-section-head strong { color: #29463a; font-size: 12px; }
.customer-detail-section-head small { color: #86918c; font-size: 9px; }
.customer-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; border: 1px solid #dde4e0; border-radius: 13px; background: #fff; }
.customer-edit-grid label { display: grid; gap: 5px; color: #6b7972; font-size: 10px; font-weight: 700; }
.customer-edit-grid .wide { grid-column: 1 / -1; }
.customer-edit-grid input,
.customer-edit-grid select,
.customer-edit-grid textarea { width: 100%; }
.customer-edit-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.customer-contact-list { display: grid; gap: 8px; }
.customer-contact-card { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.2fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid #dfe6e2; border-radius: 12px; background: #fff; }
.customer-contact-card strong { color: #294a3c; font-size: 11px; }
.customer-contact-card small { display: block; margin-top: 3px; color: #7b8781; font-size: 9px; }
.customer-contact-card a { color: #176b49; font-size: 10px; overflow-wrap: anywhere; }
.customer-primary-badge { padding: 3px 7px; border-radius: 999px; background: #e0f1e8; color: #176745; font-size: 8px; font-weight: 800; }
.customer-contact-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 9px; padding: 12px; border: 1px dashed #cbd8d1; border-radius: 12px; background: #fbfcfb; }
.customer-contact-form label { display: grid; gap: 4px; color: #6b7972; font-size: 9px; font-weight: 700; }
.customer-contact-form .wide { grid-column: 1 / -1; }
.customer-contact-form .actions { margin: 0; justify-content: flex-end; }

.customer-history-list { display: grid; gap: 8px; }
.customer-history-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 11px 12px; border: 1px solid #e0e5e2; border-radius: 11px; background: #fff; }
.customer-history-kind { padding: 3px 7px; border-radius: 999px; background: #edf3f0; color: #426255; font-size: 8px; font-weight: 800; }
.customer-history-item strong { display: block; color: #2b473b; font-size: 10px; line-height: 1.45; }
.customer-history-item small { display: block; margin-top: 4px; color: #7d8983; font-size: 9px; }
.customer-history-item time { color: #8a948f; font-size: 8px; white-space: nowrap; }

@media (max-width: 1180px) {
  .customer-list { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
  .customer-dashboard { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .customer-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .customer-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-toolbar { grid-template-columns: 1fr; }
  .customer-filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .customer-filter-row select { min-width: 0; width: 100%; }
  .customer-toolbar-foot { grid-column: 1; }
  .customer-list { grid-template-columns: 1fr; }
  .customer-form-grid { grid-template-columns: 1fr; }
  .customer-form-grid .customer-form-wide { grid-column: 1; }
  .customer-detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .customer-edit-grid { grid-template-columns: 1fr; }
  .customer-edit-grid .wide,
  .customer-edit-actions { grid-column: 1; }
  .customer-contact-card { grid-template-columns: 1fr auto; }
  .customer-contact-card > a { grid-column: 1 / -1; }
}
