/* =========================================================
   WIRTZ HUB · ENTIDADES · CLIENTES
   CRM · clientes · clasificación · deuda · seguimiento
   Premium · minimalista · responsive · dark safe
   Importador CSV corregido · contraste blanco/negro real
   ========================================================= */

/* =========================================================
   PAGE
   ========================================================= */

.clients-page {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;

  min-height: calc(100vh - var(--topbar-height) - 44px);

  animation: clientsPageIn 0.24s ease both;
}

/* =========================================================
   HEADER
   ========================================================= */

.clients-head {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: center;

  min-height: 56px;
  padding: 8px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 97%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.035);

  overflow: hidden;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

html[data-theme="dark"] .clients-head {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(10, 10, 10, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 32px rgba(0, 0, 0, 0.28);
}

.clients-brand {
  display: flex;
  align-items: center;
  gap: 8px;

  min-width: 0;
}

.clients-brand__icon {
  display: grid;
  width: 30px;
  height: 30px;
  min-width: 30px;
  place-items: center;

  border: 1px solid color-mix(in srgb, #2563eb 28%, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  background: color-mix(in srgb, #2563eb 6%, transparent);

  color: #2563eb;

  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    filter var(--transition);
}

.clients-head:hover .clients-brand__icon {
  transform: translateY(-1px);
  filter: saturate(1.12) contrast(1.03);
}

html[data-theme="dark"] .clients-brand__icon {
  border-color: color-mix(in srgb, #60a5fa 30%, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, #60a5fa 8%, transparent);
  color: #60a5fa;
}

.clients-brand__icon .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.15;
}

.clients-brand h2 {
  margin: 0;

  color: var(--text-strong);

  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.055em;
}

.clients-brand p {
  margin: 2px 0 0;
  max-width: 660px;

  color: var(--muted);

  font-size: 8.5px;
  font-weight: 760;
  line-height: 1.25;
}

html[data-theme="dark"] .clients-brand h2 {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .clients-brand p {
  color: rgba(255, 255, 255, 0.48);
}

.clients-actions,
.clients-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;

  min-width: 0;
}

/* =========================================================
   BOTONES
   ========================================================= */

.clients-btn,
.client-action,
.client-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;

  min-height: 27px;
  padding: 5px 8px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;

  color: var(--text-strong);

  font-size: 8.5px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;

  cursor: pointer;
  outline: none;

  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.clients-btn:hover,
.client-action:hover,
.client-modal__close:hover {
  border-color: rgba(0, 0, 0, 0.24);
  background: rgba(0, 0, 0, 0.055);
}

.clients-btn:active,
.client-action:active,
.client-modal__close:active {
  transform: scale(0.98);
}

.clients-btn:focus-visible,
.client-action:focus-visible,
.client-modal__close:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-strong) 16%, transparent);
}

html[data-theme="dark"] .clients-btn,
html[data-theme="dark"] .client-action,
html[data-theme="dark"] .client-modal__close {
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .clients-btn:hover,
html[data-theme="dark"] .client-action:hover,
html[data-theme="dark"] .client-modal__close:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.075);
}

.clients-btn .icon,
.client-action .icon,
.client-modal__close .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.15;
}

.clients-btn--dark,
.client-action--dark {
  border-color: rgba(17, 24, 39, 0.92);
  background: rgba(17, 24, 39, 0.96);
  color: #ffffff;
}

.clients-btn--dark:hover,
.client-action--dark:hover {
  border-color: rgba(17, 24, 39, 1);
  background: rgba(17, 24, 39, 0.9);
  opacity: 0.96;
}

html[data-theme="dark"] .clients-btn--dark,
html[data-theme="dark"] .client-action--dark {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.9);
  color: #090909;
}

html[data-theme="dark"] .clients-btn--dark:hover,
html[data-theme="dark"] .client-action--dark:hover {
  border-color: rgba(255, 255, 255, 0.98);
  background: rgba(255, 255, 255, 0.82);
}

/* =========================================================
   MÉTRICAS
   ========================================================= */

.clients-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 97%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.035);

  overflow: hidden;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

html[data-theme="dark"] .clients-metrics {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(10, 10, 10, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 32px rgba(0, 0, 0, 0.28);
}

.clients-metric {
  display: grid;
  align-content: center;
  gap: 3px;

  min-height: 46px;
  padding: 7px 8px;

  border-right: 1px solid rgba(0, 0, 0, 0.1);

  transition:
    background var(--transition),
    border-color var(--transition);
}

.clients-metric:last-child {
  border-right: 0;
}

.clients-metric:hover {
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .clients-metric {
  border-right-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .clients-metric:hover {
  background: rgba(255, 255, 255, 0.065);
}

.clients-metric span {
  min-width: 0;

  color: var(--muted);

  font-size: 7.2px;
  font-weight: 950;
  letter-spacing: 0.085em;
  line-height: 1;
  text-transform: uppercase;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clients-metric strong {
  color: var(--text-strong);

  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.06em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clients-metric small {
  color: var(--muted-2);

  font-size: 7px;
  font-weight: 820;
  line-height: 1;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .clients-metric span {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .clients-metric strong {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .clients-metric small {
  color: rgba(255, 255, 255, 0.38);
}

.clients-metric:nth-child(1) strong {
  color: #2563eb;
}

.clients-metric:nth-child(2) strong {
  color: #16a34a;
}

.clients-metric:nth-child(3) strong {
  color: #7c3aed;
}

.clients-metric:nth-child(4) strong {
  color: #0f766e;
}

.clients-metric:nth-child(5) strong {
  color: #dc2626;
}

.clients-metric:nth-child(6) strong {
  color: #ca8a04;
}

html[data-theme="dark"] .clients-metric:nth-child(1) strong {
  color: #60a5fa;
}

html[data-theme="dark"] .clients-metric:nth-child(2) strong {
  color: #4ade80;
}

html[data-theme="dark"] .clients-metric:nth-child(3) strong {
  color: #a78bfa;
}

html[data-theme="dark"] .clients-metric:nth-child(4) strong {
  color: #2dd4bf;
}

html[data-theme="dark"] .clients-metric:nth-child(5) strong {
  color: #f87171;
}

html[data-theme="dark"] .clients-metric:nth-child(6) strong {
  color: #facc15;
}

/* =========================================================
   PANEL
   ========================================================= */

.clients-panel,
.clients-flow {
  display: grid;
  min-width: 0;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 97%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.035);

  overflow: hidden;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

html[data-theme="dark"] .clients-panel,
html[data-theme="dark"] .clients-flow {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(10, 10, 10, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 32px rgba(0, 0, 0, 0.28);
}

.clients-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px;
  align-items: center;

  padding: 7px;

  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .clients-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.clients-title {
  display: grid;
  gap: 1px;

  min-width: 0;
}

.clients-title span {
  color: var(--muted);

  font-size: 7.4px;
  font-weight: 950;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.clients-title strong {
  color: var(--text-strong);

  font-size: 11.5px;
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

html[data-theme="dark"] .clients-title span {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .clients-title strong {
  color: rgba(255, 255, 255, 0.92);
}

/* =========================================================
   BUSCADOR / FILTROS
   ========================================================= */

.clients-search {
  display: flex;
  align-items: center;
  gap: 6px;

  width: min(390px, 100%);
  min-width: 240px;
  height: 28px;
  padding: 0 8px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;

  color: var(--muted);

  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.clients-search:focus-within {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .clients-search {
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .clients-search:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.065);
}

.clients-search .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  stroke-width: 2.15;

  color: #2563eb;
}

html[data-theme="dark"] .clients-search .icon {
  color: #60a5fa;
}

.clients-search input {
  width: 100%;
  min-width: 0;

  border: 0;
  background: transparent;

  color: var(--text-strong);
  outline: none;

  font-size: 9px;
  font-weight: 780;
}

.clients-search input::placeholder {
  color: var(--muted-2);
}

html[data-theme="dark"] .clients-search input {
  color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .clients-search input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.clients-filters select {
  height: 28px;
  min-width: 96px;
  padding: 0 8px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;

  color: var(--text-strong);
  outline: none;

  font-size: 8.5px;
  font-weight: 850;

  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.clients-filters select:hover,
.clients-filters select:focus {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .clients-filters select {
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .clients-filters select:hover,
html[data-theme="dark"] .clients-filters select:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.065);
}

/* =========================================================
   TABLA
   ========================================================= */

.clients-table-wrap {
  width: 100%;
  max-width: 100%;

  overflow-x: hidden !important;
  overflow-y: auto !important;

  scrollbar-width: thin;
  scrollbar-color: rgba(120, 128, 145, 0.35) transparent;
}

.clients-table-wrap::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.clients-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.clients-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(120, 128, 145, 0.35);
  background-clip: content-box;
}

.clients-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 128, 145, 0.55);
  background-clip: content-box;
}

.clients-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;

  border-collapse: collapse;
  background: transparent;
}

.clients-table th,
.clients-table td {
  position: relative;

  height: 32px;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;

  padding: 0 8px;

  border-right: 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);

  box-shadow: none !important;

  color: var(--text);

  font-size: 8.6px;
  font-weight: 720;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html[data-theme="dark"] .clients-table th,
html[data-theme="dark"] .clients-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
}

.clients-table th {
  position: sticky;
  top: 0;
  z-index: 2;

  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  color: var(--muted);

  font-size: 7px;
  font-weight: 950;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

html[data-theme="dark"] .clients-table th {
  background: rgba(10, 10, 10, 0.98);
  color: rgba(255, 255, 255, 0.46);
}

.clients-table tbody tr {
  transition:
    background var(--transition),
    color var(--transition);
}

.clients-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .clients-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.clients-table strong {
  color: var(--text-strong);
  font-weight: 950;
}

html[data-theme="dark"] .clients-table strong {
  color: rgba(255, 255, 255, 0.9);
}

/* Anchos proporcionales para evitar scroll horizontal */
.clients-table th:nth-child(1),
.clients-table td:nth-child(1) {
  width: 7% !important;
}

.clients-table th:nth-child(2),
.clients-table td:nth-child(2) {
  width: 18% !important;
}

.clients-table th:nth-child(3),
.clients-table td:nth-child(3) {
  width: 8% !important;
}

.clients-table th:nth-child(4),
.clients-table td:nth-child(4) {
  width: 8% !important;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5) {
  width: 8% !important;
}

.clients-table th:nth-child(6),
.clients-table td:nth-child(6) {
  width: 15% !important;
}

.clients-table th:nth-child(7),
.clients-table td:nth-child(7) {
  width: 9% !important;
}

.clients-table th:nth-child(8),
.clients-table td:nth-child(8) {
  width: 8% !important;
  text-align: right !important;
}

.clients-table th:nth-child(9),
.clients-table td:nth-child(9) {
  width: 7% !important;
}

.clients-table th:nth-child(10),
.clients-table td:nth-child(10) {
  width: 8% !important;
}

.clients-table th:nth-child(11),
.clients-table td:nth-child(11) {
  width: 12% !important;
}

/* Separadores finos por fila */
.clients-table th:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;

  width: 1px;
  height: 12px;

  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);

  transform: translateY(-50%);
}

.clients-table td:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;

  width: 1px;
  height: 14px;

  border-radius: 999px;
  background: rgba(0, 0, 0, 0.095);

  transform: translateY(-50%);
}

html[data-theme="dark"] .clients-table th:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.17);
}

html[data-theme="dark"] .clients-table td:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.1);
}

.clients-table tbody tr:hover td:not(:last-child)::after {
  background: rgba(0, 0, 0, 0.17);
}

html[data-theme="dark"] .clients-table tbody tr:hover td:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.19);
}

/* =========================================================
   ORDENAMIENTO
   ========================================================= */

.clients-th {
  position: sticky;
  top: 0;
  z-index: 3;
  overflow: visible;
}

.clients-th__sort {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;

  width: 100% !important;
  min-width: 0;
  height: 100%;
  padding: 0;

  border: 0;
  background: transparent;
  color: inherit;

  font: inherit;
  text-align: left;
  text-transform: inherit;
  letter-spacing: inherit;

  cursor: pointer;
}

.clients-th__sort:disabled {
  cursor: default;
}

.clients-th__sort span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clients-th__sort .icon {
  width: 9px;
  height: 9px;
  min-width: 9px;
  color: var(--muted);
  opacity: 0.72;
}

.clients-th.is-sorted .clients-th__sort {
  color: var(--text-strong);
}

.clients-th.is-sorted .clients-th__sort .icon {
  color: #2563eb;
  opacity: 1;
}

html[data-theme="dark"] .clients-th.is-sorted .clients-th__sort {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .clients-th.is-sorted .clients-th__sort .icon {
  color: #60a5fa;
}

.clients-th__resize {
  display: none !important;
}

/* =========================================================
   BADGES TABLA
   ========================================================= */

.client-code,
.client-type,
.client-status,
.client-score,
.client-debt {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  min-height: 18px;
  padding: 2px 7px;

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.025);

  color: var(--text-strong);

  font-size: 7.5px;
  font-weight: 950;
  line-height: 1;
}

html[data-theme="dark"] .client-code,
html[data-theme="dark"] .client-type,
html[data-theme="dark"] .client-status,
html[data-theme="dark"] .client-score,
html[data-theme="dark"] .client-debt {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.88);
}

.client-status::before,
.client-score::before,
.client-debt::before {
  content: "";

  width: 5px;
  height: 5px;

  border-radius: 999px;
  background: var(--muted);
}

.client-status.is-active::before,
.client-score.is-a::before,
.client-debt.is-clear::before {
  background: var(--success);
}

.client-status.is-review::before,
.client-score.is-b::before,
.client-debt.is-pending::before {
  background: var(--warning);
}

.client-score.is-c::before {
  background: var(--danger);
}

/* Código, deuda y score como texto limpio */
.client-code,
.client-debt,
.client-score {
  display: inline !important;

  min-height: auto !important;
  padding: 0 !important;

  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;

  color: var(--text-strong) !important;

  font-size: 8.7px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: -0.015em !important;
}

html[data-theme="dark"] .client-code,
html[data-theme="dark"] .client-debt,
html[data-theme="dark"] .client-score {
  color: rgba(255, 255, 255, 0.9) !important;
}

.client-score::before,
.client-debt::before {
  display: none !important;
}

.client-code {
  color: var(--muted) !important;
  font-weight: 850 !important;
}

html[data-theme="dark"] .client-code {
  color: rgba(255, 255, 255, 0.55) !important;
}

.client-debt {
  color: var(--danger) !important;
}

.client-debt.is-clear {
  color: var(--success) !important;
}

.client-debt.is-pending {
  color: var(--danger) !important;
}

html[data-theme="dark"] .client-debt {
  color: #f87171 !important;
}

html[data-theme="dark"] .client-debt.is-clear {
  color: #4ade80 !important;
}

html[data-theme="dark"] .client-debt.is-pending {
  color: #f87171 !important;
}

.client-score {
  color: var(--text-strong) !important;
}

.client-score.is-a {
  color: var(--success) !important;
}

.client-score.is-b {
  color: var(--warning) !important;
}

.client-score.is-c {
  color: var(--danger) !important;
}

html[data-theme="dark"] .client-score {
  color: rgba(255, 255, 255, 0.9) !important;
}

html[data-theme="dark"] .client-score.is-a {
  color: #4ade80 !important;
}

html[data-theme="dark"] .client-score.is-b {
  color: #facc15 !important;
}

html[data-theme="dark"] .client-score.is-c {
  color: #f87171 !important;
}

.client-type,
.client-status {
  min-height: 17px;
  padding: 2px 6px;

  font-size: 7.2px;
}

/* =========================================================
   CLIENTE / CONTACTO
   ========================================================= */

.client-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  max-width: 100% !important;
  min-width: 0 !important;

  color: var(--text-strong);

  font-weight: 950;
  text-overflow: ellipsis;
  vertical-align: bottom;

  overflow: hidden;
}

html[data-theme="dark"] .client-name {
  color: rgba(255, 255, 255, 0.9);
}

.client-avatar {
  display: grid;
  width: 20px;
  height: 20px;
  min-width: 20px;
  place-items: center;

  border: 1px solid rgba(17, 24, 39, 0.92);
  border-radius: 7px;
  background: rgba(17, 24, 39, 0.96);

  color: #ffffff;

  font-size: 7px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

html[data-theme="dark"] .client-avatar {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.9);
  color: #090909;
}

.client-contact,
.client-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;

  max-width: 100% !important;
  min-width: 0 !important;

  color: var(--text-strong);

  font-weight: 870;

  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .client-contact,
html[data-theme="dark"] .client-date {
  color: rgba(255, 255, 255, 0.82);
}

.client-contact .icon,
.client-date .icon {
  width: 11px;
  height: 11px;
  min-width: 11px;
  stroke-width: 2.15;

  color: var(--muted);
}

.client-contact .icon {
  color: #2563eb;
}

.client-date .icon {
  color: #7c3aed;
}

html[data-theme="dark"] .client-contact .icon {
  color: #60a5fa;
}

html[data-theme="dark"] .client-date .icon {
  color: #a78bfa;
}

.clients-table td:nth-child(8),
.clients-table th:nth-child(8) {
  text-align: right;
}

.client-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.client-action {
  max-width: 100%;
  min-height: 24px;
  padding: 4px 6px;

  font-size: 7.6px;
}

.client-action .icon {
  width: 10px;
  height: 10px;
}

/* =========================================================
   FLUJO
   ========================================================= */

.clients-flow {
  align-content: start;
}

.clients-flow__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  min-height: 38px;
  padding: 7px 8px;

  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .clients-flow__head {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.clients-flow__head span {
  color: var(--muted);

  font-size: 7.4px;
  font-weight: 950;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.clients-flow__head strong {
  display: block;
  margin-top: 2px;

  color: var(--text-strong);

  font-size: 11.5px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.04em;
}

.clients-flow__head .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.15;

  color: #2563eb;
}

html[data-theme="dark"] .clients-flow__head span {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .clients-flow__head strong {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .clients-flow__head .icon {
  color: #60a5fa;
}

.clients-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.clients-event {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;

  min-height: 62px;
  padding: 8px;

  border-right: 1px solid rgba(0, 0, 0, 0.1);

  transition:
    background var(--transition),
    border-color var(--transition);
}

.clients-event:last-child {
  border-right: 0;
}

.clients-event:hover {
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .clients-event {
  border-right-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .clients-event:hover {
  background: rgba(255, 255, 255, 0.065);
}

.clients-event__icon {
  display: grid;
  width: 24px;
  height: 24px;
  min-width: 24px;
  place-items: center;

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: transparent;

  color: #2563eb;

  transition:
    color var(--transition),
    transform var(--transition),
    filter var(--transition);
}

.clients-event:hover .clients-event__icon {
  transform: translateY(-1px);
  filter: saturate(1.12) contrast(1.03);
}

html[data-theme="dark"] .clients-event__icon {
  border-color: rgba(255, 255, 255, 0.11);
  color: #60a5fa;
}

.clients-event__icon .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.15;
}

.clients-event__body {
  display: grid;
  align-content: start;
  gap: 3px;

  min-width: 0;
}

.clients-event__body strong {
  color: var(--text-strong);

  font-size: 9px;
  font-weight: 950;
  line-height: 1.1;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clients-event__body p {
  margin: 0;

  color: var(--muted);

  font-size: 7.8px;
  font-weight: 760;
  line-height: 1.3;

  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.clients-event__body small {
  color: var(--muted-2);

  font-size: 7px;
  font-weight: 850;
  line-height: 1;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .clients-event__body strong {
  color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .clients-event__body p {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .clients-event__body small {
  color: rgba(255, 255, 255, 0.38);
}

/* =========================================================
   MODAL BASE
   ========================================================= */

.client-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: none;
  place-items: center;

  padding: 18px;

  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.client-modal.is-open {
  display: grid;
  animation: clientModalBackdropIn 0.16s ease both;
}

.client-modal__card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;

  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 36px));

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;

  overflow: hidden;

  animation: clientModalIn 0.2s ease both;
}

html[data-theme="dark"] .client-modal__card {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 10, 0.96);
  box-shadow:
    0 22px 80px rgba(0, 0, 0, 0.58),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.client-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 9px;

  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .client-modal__head {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.client-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;

  min-width: 0;
}

.client-modal__avatar {
  display: grid;
  width: 32px;
  height: 32px;
  min-width: 32px;
  place-items: center;

  border: 1px solid rgba(17, 24, 39, 0.92);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.96);

  color: #ffffff;

  font-size: 8.5px;
  font-weight: 950;
}

html[data-theme="dark"] .client-modal__avatar {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.9);
  color: #090909;
}

.client-modal__title h3 {
  margin: 0;

  color: var(--text-strong);

  font-size: 12.5px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.045em;
}

.client-modal__title p {
  margin: 2px 0 0;

  color: var(--muted);

  font-size: 8.3px;
  font-weight: 730;
  line-height: 1.3;
}

html[data-theme="dark"] .client-modal__title h3 {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .client-modal__title p {
  color: rgba(255, 255, 255, 0.48);
}

.client-modal__close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  flex: 0 0 auto;
}

.client-modal__body {
  display: grid;
  gap: 8px;

  min-height: 0;
  padding: 9px;

  overflow: auto;

  scrollbar-width: thin;
  scrollbar-color: rgba(120, 128, 145, 0.35) transparent;
}

.client-modal__body::-webkit-scrollbar {
  width: 7px;
}

.client-modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.client-modal__body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(120, 128, 145, 0.35);
  background-clip: content-box;
}

.client-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 5px;

  padding: 9px;

  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .client-modal__footer {
  border-top-color: rgba(255, 255, 255, 0.09);
}

/* =========================================================
   FORM MODAL
   ========================================================= */

.client-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;

  overflow: hidden;
}

html[data-theme="dark"] .client-form-grid {
  border-color: rgba(255, 255, 255, 0.1);
}

.client-field {
  display: grid;
  gap: 4px;

  min-height: 58px;
  padding: 8px;

  border-right: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;

  transition:
    background var(--transition),
    border-color var(--transition);
}

.client-field:hover {
  background: rgba(0, 0, 0, 0.035);
}

html[data-theme="dark"] .client-field {
  border-right-color: rgba(255, 255, 255, 0.09);
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .client-field:hover {
  background: rgba(255, 255, 255, 0.055);
}

.client-field:nth-child(2n) {
  border-right: 0;
}

.client-field:nth-last-child(1),
.client-field:nth-last-child(2):nth-child(odd) {
  border-bottom: 0;
}

.client-field label {
  color: var(--muted);

  font-size: 7.2px;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

html[data-theme="dark"] .client-field label {
  color: rgba(255, 255, 255, 0.48);
}

.client-field input,
.client-field select,
.client-field textarea {
  width: 100%;
  min-width: 0;

  border: 0;
  background: transparent;

  color: var(--text-strong);
  outline: none;

  font-size: 9px;
  font-weight: 820;

  resize: none;
}

html[data-theme="dark"] .client-field input,
html[data-theme="dark"] .client-field select,
html[data-theme="dark"] .client-field textarea {
  color: rgba(255, 255, 255, 0.9);
}

.client-field input::placeholder,
.client-field textarea::placeholder {
  color: var(--muted-2);
}

html[data-theme="dark"] .client-field input::placeholder,
html[data-theme="dark"] .client-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.client-field textarea {
  min-height: 42px;
  line-height: 1.35;
}

.client-field--full {
  grid-column: 1 / -1;
}

/* =========================================================
   IMPORTADOR CSV · BLANCO / NEGRO REAL
   ========================================================= */

.clients-import-modal {
  background: rgba(0, 0, 0, 0.36);
}

html[data-theme="dark"] .clients-import-modal {
  background: rgba(0, 0, 0, 0.72);
}

.clients-import-card {
  width: min(680px, 100%);
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card {
  background: #000000 !important;
  color: #ffffff !important;
}

.clients-import-card .client-modal__head,
.clients-import-card .client-modal__footer {
  background: #ffffff !important;
  border-color: #d8d8d8 !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__head,
html[data-theme="dark"] .clients-import-card .client-modal__footer {
  background: #000000 !important;
  border-color: #2a2a2a !important;
}

.clients-import-card .client-modal__title h3,
.clients-import-card .client-modal__title p,
.clients-import-card span,
.clients-import-card strong,
.clients-import-card small,
.clients-import-card p,
.clients-import-card pre {
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__title h3,
html[data-theme="dark"] .clients-import-card .client-modal__title p,
html[data-theme="dark"] .clients-import-card span,
html[data-theme="dark"] .clients-import-card strong,
html[data-theme="dark"] .clients-import-card small,
html[data-theme="dark"] .clients-import-card p,
html[data-theme="dark"] .clients-import-card pre {
  color: #ffffff !important;
}

.clients-import-card .client-modal__avatar {
  background: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__avatar {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #000000 !important;
}

.clients-import-card .client-modal__avatar .icon {
  stroke: currentColor !important;
}

.clients-import-card .client-modal__close {
  border-color: #d8d8d8 !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.clients-import-card .client-modal__close:hover {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__close {
  border-color: #2a2a2a !important;
  background: #000000 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__close:hover {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.clients-import-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;

  padding: 10px;

  border: 1px solid #d8d8d8 !important;
  border-radius: 13px;
  background: #ffffff !important;
}

html[data-theme="dark"] .clients-import-hero {
  border-color: #2a2a2a !important;
  background: #000000 !important;
}

.clients-import-hero span,
.clients-import-preview span {
  display: block;

  color: #000000 !important;

  font-size: 7.2px;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

html[data-theme="dark"] .clients-import-hero span,
html[data-theme="dark"] .clients-import-preview span {
  color: #ffffff !important;
}

.clients-import-hero strong {
  display: block;
  margin-top: 4px;

  color: #000000 !important;

  font-size: 10.5px;
  font-weight: 950;
  line-height: 1.15;
}

html[data-theme="dark"] .clients-import-hero strong {
  color: #ffffff !important;
}

.clients-import-hero p {
  max-width: 520px;
  margin: 4px 0 0;

  color: #000000 !important;

  font-size: 8.4px;
  font-weight: 760;
  line-height: 1.35;
}

html[data-theme="dark"] .clients-import-hero p {
  color: #ffffff !important;
}

/* Botón descargar plantilla */
.clients-import-card [data-download-client-template] {
  min-width: 150px;

  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
}

.clients-import-card [data-download-client-template] span,
.clients-import-card [data-download-client-template] small,
.clients-import-card [data-download-client-template] strong {
  color: #ffffff !important;
}

.clients-import-card [data-download-client-template] .icon {
  color: #ffffff !important;
  stroke: currentColor !important;
}

.clients-import-card [data-download-client-template]:hover {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  opacity: 0.92 !important;
}

html[data-theme="dark"] .clients-import-card [data-download-client-template] {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card [data-download-client-template] span,
html[data-theme="dark"] .clients-import-card [data-download-client-template] small,
html[data-theme="dark"] .clients-import-card [data-download-client-template] strong {
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card [data-download-client-template] .icon {
  color: #000000 !important;
  stroke: currentColor !important;
}

html[data-theme="dark"] .clients-import-card [data-download-client-template]:hover {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
  opacity: 0.92 !important;
}

.clients-import-drop {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;

  min-height: 76px;
  padding: 12px;

  border: 1px dashed #000000 !important;
  border-radius: 14px;
  background: #ffffff !important;

  cursor: pointer;

  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.clients-import-drop:hover {
  background: #f7f7f7 !important;
  transform: translateY(-1px);
}

html[data-theme="dark"] .clients-import-drop {
  border-color: #ffffff !important;
  background: #000000 !important;
}

html[data-theme="dark"] .clients-import-drop:hover {
  background: #101010 !important;
}

.clients-import-drop > .icon {
  width: 24px;
  height: 24px;
  color: #000000 !important;
  stroke-width: 2.1;
}

html[data-theme="dark"] .clients-import-drop > .icon {
  color: #ffffff !important;
}

.clients-import-drop strong {
  display: block;

  color: #000000 !important;

  font-size: 10px;
  font-weight: 950;
  line-height: 1.1;
}

.clients-import-drop small {
  display: block;
  margin-top: 4px;

  color: #000000 !important;

  font-size: 8.4px;
  font-weight: 800;
  line-height: 1.25;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .clients-import-drop strong,
html[data-theme="dark"] .clients-import-drop small {
  color: #ffffff !important;
}

.clients-import-preview {
  display: grid;
  gap: 6px;

  padding: 9px;

  border: 1px solid #d8d8d8 !important;
  border-radius: 13px;
  background: #ffffff !important;
}

html[data-theme="dark"] .clients-import-preview {
  border-color: #2a2a2a !important;
  background: #000000 !important;
}

.clients-import-preview pre {
  min-height: 78px;
  max-height: 160px;
  margin: 0;
  padding: 8px;

  border-radius: 10px;
  background: #f4f4f4 !important;

  color: #000000 !important;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 8px;
  font-weight: 750;
  line-height: 1.45;

  white-space: pre;
  overflow: auto;
}

html[data-theme="dark"] .clients-import-preview pre {
  background: #050505 !important;
  color: #ffffff !important;
}

.clients-import-help {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  border: 1px solid #d8d8d8 !important;
  border-radius: 13px;
  overflow: hidden;

  background: #ffffff !important;
}

html[data-theme="dark"] .clients-import-help {
  border-color: #2a2a2a !important;
  background: #000000 !important;
}

.clients-import-help article {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;

  border-right: 1px solid #d8d8d8 !important;
}

.clients-import-help article:last-child {
  border-right: 0 !important;
}

html[data-theme="dark"] .clients-import-help article {
  border-right-color: #2a2a2a !important;
}

.clients-import-help strong {
  color: #000000 !important;

  font-size: 8.8px;
  font-weight: 950;
  line-height: 1.1;
}

.clients-import-help span {
  color: #000000 !important;

  font-size: 7.6px;
  font-weight: 760;
  line-height: 1.3;
}

html[data-theme="dark"] .clients-import-help strong,
html[data-theme="dark"] .clients-import-help span {
  color: #ffffff !important;
}

.clients-import-result {
  display: grid;
  gap: 7px;

  padding: 9px;

  border: 1px solid #d8d8d8 !important;
  border-radius: 12px;
  background: #ffffff !important;
}

html[data-theme="dark"] .clients-import-result {
  border-color: #2a2a2a !important;
  background: #000000 !important;
}

.clients-import-result strong {
  color: #000000 !important;

  font-size: 9px;
  font-weight: 950;
  line-height: 1.2;
}

html[data-theme="dark"] .clients-import-result strong {
  color: #ffffff !important;
}

.clients-import-result.is-ok {
  border-color: #000000 !important;
  background: #ffffff !important;
}

.clients-import-result.is-error {
  border-color: #000000 !important;
  background: #ffffff !important;
}

html[data-theme="dark"] .clients-import-result.is-ok,
html[data-theme="dark"] .clients-import-result.is-error {
  border-color: #ffffff !important;
  background: #000000 !important;
}

.clients-import-result__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  border: 1px solid #d8d8d8 !important;
  border-radius: 10px;
  overflow: hidden;
}

html[data-theme="dark"] .clients-import-result__grid {
  border-color: #2a2a2a !important;
}

.clients-import-result__grid span,
.clients-import-result__grid strong {
  min-height: 24px;
  padding: 6px 8px;

  border-bottom: 1px solid #d8d8d8 !important;

  color: #000000 !important;

  font-size: 8px;
  line-height: 1.1;
}

html[data-theme="dark"] .clients-import-result__grid span,
html[data-theme="dark"] .clients-import-result__grid strong {
  border-bottom-color: #2a2a2a !important;
  color: #ffffff !important;
}

.clients-import-result__grid span:nth-last-child(1),
.clients-import-result__grid strong:nth-last-child(1),
.clients-import-result__grid span:nth-last-child(2),
.clients-import-result__grid strong:nth-last-child(2) {
  border-bottom: 0 !important;
}

.clients-import-result__grid span {
  font-weight: 850;
}

.clients-import-result__grid strong {
  font-weight: 950;
  text-align: right;
}

/* Botones footer importador */
.clients-import-card .client-modal__footer .clients-btn {
  color: #000000 !important;
}

.clients-import-card .client-modal__footer .clients-btn span,
.clients-import-card .client-modal__footer .clients-btn .icon {
  color: #000000 !important;
  stroke: currentColor !important;
}

.clients-import-card .client-modal__footer .clients-btn:hover {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
}

.clients-import-card .client-modal__footer .clients-btn:hover span,
.clients-import-card .client-modal__footer .clients-btn:hover .icon {
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn {
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn span,
html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn .icon {
  color: #ffffff !important;
  stroke: currentColor !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn:hover {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn:hover span,
html[data-theme="dark"] .clients-import-card .client-modal__footer .clients-btn:hover .icon {
  color: #000000 !important;
}

/* Botón importar clientes */
.clients-import-card [data-import-submit] {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
}

.clients-import-card [data-import-submit] span,
.clients-import-card [data-import-submit] .icon {
  color: #ffffff !important;
  stroke: currentColor !important;
}

.clients-import-card [data-import-submit]:hover {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  opacity: 0.92 !important;
}

.clients-import-card [data-import-submit]:disabled {
  border-color: #000000 !important;
  background: #000000 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

.clients-import-card [data-import-submit]:disabled span,
.clients-import-card [data-import-submit]:disabled .icon {
  color: #ffffff !important;
}

html[data-theme="dark"] .clients-import-card [data-import-submit] {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] .clients-import-card [data-import-submit] span,
html[data-theme="dark"] .clients-import-card [data-import-submit] .icon {
  color: #000000 !important;
  stroke: currentColor !important;
}

html[data-theme="dark"] .clients-import-card [data-import-submit]:hover {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
  opacity: 0.92 !important;
}

html[data-theme="dark"] .clients-import-card [data-import-submit]:disabled {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

html[data-theme="dark"] .clients-import-card [data-import-submit]:disabled span,
html[data-theme="dark"] .clients-import-card [data-import-submit]:disabled .icon {
  color: #000000 !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1380px) {
  .clients-head {
    grid-template-columns: 1fr;
  }

  .clients-actions {
    justify-content: flex-start;
  }

  .clients-toolbar {
    grid-template-columns: 1fr;
  }

  .clients-filters {
    justify-content: flex-start;
  }

  .clients-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clients-event:nth-child(2n) {
    border-right: 0;
  }

  .clients-event:nth-child(n + 3) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .clients-event:nth-child(n + 3) {
    border-top-color: rgba(255, 255, 255, 0.09);
  }
}

@media (max-width: 1100px) {
  .clients-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .clients-metric:nth-child(3n) {
    border-right: 0;
  }

  .clients-metric:nth-child(n + 4) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .clients-metric:nth-child(n + 4) {
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .clients-table th,
  .clients-table td {
    padding-left: 6px !important;
    padding-right: 7px !important;
    font-size: 7.8px !important;
  }

  .clients-table th {
    font-size: 6.4px !important;
  }

  .client-contact .icon,
  .client-date .icon,
  .clients-th__sort .icon {
    display: none !important;
  }

  .client-action span {
    display: none !important;
  }

  .client-action {
    width: 24px;
    min-width: 24px;
    padding: 0 !important;
  }
}

@media (max-width: 820px) {
  .clients-page {
    gap: 6px;
  }

  .clients-head {
    padding: 7px;
  }

  .clients-actions,
  .clients-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .clients-search {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .clients-btn,
  .clients-filters select {
    width: 100%;
  }

  .clients-table {
    width: 100% !important;
    min-width: 0 !important;
  }

  .clients-table th,
  .clients-table td {
    padding-left: 4px !important;
    padding-right: 5px !important;
    font-size: 7px !important;
  }

  .clients-table th {
    font-size: 5.9px !important;
    letter-spacing: 0.045em !important;
  }

  .client-avatar {
    display: none !important;
  }

  .client-type,
  .client-status {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 6.8px !important;
  }

  .client-status::before {
    display: none !important;
  }

  .client-code,
  .client-debt,
  .client-score {
    font-size: 7px !important;
  }

  .client-modal {
    padding: 10px;
  }

  .client-modal__card {
    max-height: calc(100vh - 20px);
  }
}

@media (max-width: 720px) {
  .clients-import-hero {
    grid-template-columns: 1fr;
  }

  .clients-import-hero .clients-btn {
    width: 100%;
  }

  .clients-import-help {
    grid-template-columns: 1fr;
  }

  .clients-import-help article {
    border-right: 0 !important;
    border-bottom: 1px solid #d8d8d8 !important;
  }

  .clients-import-help article:last-child {
    border-bottom: 0 !important;
  }

  html[data-theme="dark"] .clients-import-help article {
    border-bottom-color: #2a2a2a !important;
  }
}

@media (max-width: 620px) {
  .clients-brand {
    align-items: flex-start;
  }

  .clients-brand p {
    font-size: 8.2px;
  }

  .clients-actions,
  .clients-filters {
    grid-template-columns: 1fr;
  }

  .clients-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clients-metric {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  .clients-metric:nth-child(1),
  .clients-metric:nth-child(2) {
    border-top: 0;
  }

  .clients-metric:nth-child(2n) {
    border-right: 0;
  }

  html[data-theme="dark"] .clients-metric {
    border-right-color: rgba(255, 255, 255, 0.09);
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .clients-timeline {
    grid-template-columns: 1fr;
  }

  .clients-event {
    border-right: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  .clients-event:first-child {
    border-top: 0;
  }

  html[data-theme="dark"] .clients-event {
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .client-form-grid {
    grid-template-columns: 1fr;
  }

  .client-field {
    border-right: 0;
  }

  .client-field:nth-child(2n) {
    border-right: 0;
  }

  .client-field:nth-last-child(2):nth-child(odd) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .client-field:nth-last-child(2):nth-child(odd) {
    border-bottom-color: rgba(255, 255, 255, 0.09);
  }

  .client-modal__footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .client-modal__footer .clients-btn {
    width: 100%;
  }

  .clients-table th,
  .clients-table td {
    padding-left: 3px !important;
    padding-right: 4px !important;
    font-size: 6.5px !important;
  }

  .clients-table th {
    font-size: 5.5px !important;
  }

  .clients-table th:nth-child(7),
  .clients-table td:nth-child(7),
  .clients-table th:nth-child(10),
  .clients-table td:nth-child(10) {
    display: none !important;
  }

  .clients-table th:nth-child(1),
  .clients-table td:nth-child(1) {
    width: 8% !important;
  }

  .clients-table th:nth-child(2),
  .clients-table td:nth-child(2) {
    width: 22% !important;
  }

  .clients-table th:nth-child(3),
  .clients-table td:nth-child(3) {
    width: 10% !important;
  }

  .clients-table th:nth-child(4),
  .clients-table td:nth-child(4) {
    width: 10% !important;
  }

  .clients-table th:nth-child(5),
  .clients-table td:nth-child(5) {
    width: 10% !important;
  }

  .clients-table th:nth-child(6),
  .clients-table td:nth-child(6) {
    width: 18% !important;
  }

  .clients-table th:nth-child(8),
  .clients-table td:nth-child(8) {
    width: 9% !important;
  }

  .clients-table th:nth-child(9),
  .clients-table td:nth-child(9) {
    width: 7% !important;
  }

  .clients-table th:nth-child(11),
  .clients-table td:nth-child(11) {
    width: 6% !important;
  }
}

@media (max-width: 520px) {
  .clients-import-drop {
    grid-template-columns: 1fr;
  }

  .clients-import-result__grid {
    grid-template-columns: 1fr;
  }

  .clients-import-result__grid strong {
    text-align: left;
  }

  .clients-import-result__grid span:nth-last-child(2) {
    border-bottom: 1px solid #d8d8d8 !important;
  }

  html[data-theme="dark"] .clients-import-result__grid span:nth-last-child(2) {
    border-bottom-color: #2a2a2a !important;
  }
}

@media (max-width: 420px) {
  .clients-head,
  .clients-panel,
  .clients-flow,
  .clients-metrics {
    border-radius: 12px;
  }

  .clients-brand__icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .clients-brand h2 {
    font-size: 12.5px;
  }

  .clients-brand p {
    display: none;
  }

  .clients-metrics {
    grid-template-columns: 1fr;
  }

  .clients-metric {
    border-right: 0;
  }

  .clients-metric:nth-child(2) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .clients-metric:nth-child(2) {
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .clients-toolbar {
    padding: 6px;
  }

  .client-modal__head {
    align-items: flex-start;
  }

  .client-modal__title p {
    display: none;
  }
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes clientsPageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes clientModalBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes clientModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Respeta usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  .clients-page,
  .clients-page *,
  .clients-page *::before,
  .clients-page *::after,
  .client-modal,
  .client-modal *,
  .client-modal *::before,
  .client-modal *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}