/* Prevención, alta y fusión de clientes */
.duplicate-client-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #efd5a8;
  border-radius: 18px;
  background: #fff6df;
  box-shadow: 0 8px 22px rgba(95, 66, 55, .06);
}
.duplicate-client-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.86);
  font-size: 1.25rem;
}
.duplicate-client-content { min-width: 0; }
.duplicate-client-content > b { display: block; margin-bottom: 4px; }
.duplicate-client-content p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.duplicate-client-content p strong { color: var(--cocoa); }
.duplicate-client-content > small {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
}
.duplicate-client-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.duplicate-client-actions .primary-button,
.duplicate-client-actions .ghost-button {
  min-width: 0;
  max-width: 100%;
}

.clients-heading {
  align-items: flex-start;
  gap: 14px;
}
.clients-heading > div { min-width: 0; }
.client-create-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.empty-create-client {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
.client-form-duplicate { margin-bottom: 14px; }
.client-name-help {
  margin-top: -6px;
  margin-bottom: 5px;
  line-height: 1.4;
}

.client-search-panel {
  display: grid;
  gap: 6px;
  margin: 14px 0 18px;
}
.client-search-field {
  position: relative;
  display: block;
}
.client-search-field input {
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 48px 0 46px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--cocoa);
  font: inherit;
  font-size: .9rem;
  box-shadow: 0 8px 24px rgba(95, 66, 55, .05);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.client-search-field input::placeholder { color: var(--muted); }
.client-search-field input:focus {
  outline: none;
  border-color: var(--terracotta-deep);
  box-shadow: 0 0 0 3px rgba(196, 111, 92, .14), 0 8px 24px rgba(95, 66, 55, .05);
}
.client-search-icon {
  position: absolute;
  z-index: 1;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--terracotta-deep);
  font-size: 1.35rem;
  line-height: 1;
  pointer-events: none;
}
.client-search-clear {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 50%;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.client-search-clear:hover,
.client-search-clear:focus-visible {
  background: #fff3ed;
  color: var(--terracotta-deep);
  outline: none;
}
.client-search-count {
  min-height: 18px;
  padding-left: 3px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 750;
}
.client-card[hidden],
.client-search-clear[hidden],
.client-search-empty[hidden] {
  display: none !important;
}
.client-search-empty {
  margin-top: 0;
}

.client-merge {
  margin-top: 8px;
  border-top: 1px solid #f1e7e0;
  padding-top: 7px;
}
.client-merge > summary {
  width: fit-content;
  cursor: pointer;
  list-style: none;
  color: var(--terracotta-deep);
  font-size: .72rem;
  font-weight: 850;
  user-select: none;
}
.client-merge > summary::-webkit-details-marker { display: none; }
.client-merge > summary::before { content: "⇄ "; }
.client-merge[open] > summary { margin-bottom: 9px; }
.client-merge-panel {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf6;
}
.client-merge-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.4;
}
.client-merge-panel form {
  display: grid;
  gap: 8px;
  margin: 0;
}
.client-merge-panel label {
  gap: 5px;
  font-size: .7rem;
}
.client-merge-panel select {
  width: 100%;
  min-width: 0;
}
.client-merge-panel .secondary-button { width: 100%; }
.client-merge-panel > small {
  display: block;
  margin-top: 8px;
  font-size: .64rem;
  line-height: 1.35;
}
.client-card .client-main { min-width: 0; }

@media (max-width: 560px) {
  .clients-heading {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .client-create-button,
  .empty-create-client {
    width: 100%;
    min-height: 44px;
    white-space: normal;
    text-align: center;
  }
  .client-search-panel {
    margin-top: 12px;
    margin-bottom: 15px;
  }
  .client-search-field input {
    min-height: 50px;
    padding-left: 43px;
    font-size: .86rem;
  }
  .client-search-icon { left: 14px; }
  .duplicate-client-alert {
    grid-template-columns: 1fr;
    padding: 13px;
  }
  .duplicate-client-icon {
    width: 38px;
    height: 38px;
  }
  .duplicate-client-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .duplicate-client-actions .primary-button,
  .duplicate-client-actions .ghost-button {
    width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    padding-block: 10px;
  }
  .client-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
  }
  .client-merge-panel { padding: 10px; }
}
