/* Cadastro de Clientes — painel operacional */

#clientes-view {
  --cli-purple: #7c3aed;
  --cli-purple-soft: #f3efff;
  --cli-border: #e7e7f1;
}

.clientes-shell {
  width: 100%;
  min-width: 0;
}

.clientes-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.clientes-page-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.clientes-page-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--cli-purple-soft);
  color: var(--cli-purple);
  font-size: 20px;
}

.clientes-page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-page-title);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.clientes-page-heading p {
  margin: 5px 0 0;
  color: var(--text-light);
  font-size: var(--text-subtitle);
}

.clientes-page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 0 auto;
}

.clientes-back-button,
.clientes-new-button {
  box-sizing: border-box;
  width: 168px;
  min-height: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: var(--text-btn);
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.clientes-back-button[hidden],
.clientes-new-button[hidden] {
  display: none !important;
}

.clientes-back-button {
  border: 1px solid #d8d0e8;
  background: #fff;
  color: #5b276f;
}

.clientes-back-button:hover {
  border-color: #b9a5d4;
  background: #f7f2fc;
}

.clientes-new-button {
  border: 0;
  background: linear-gradient(135deg, #7331db, #5b21b6);
  color: #fff;
  box-shadow: 0 7px 16px rgba(91, 33, 182, 0.2);
}

.clientes-new-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(91, 33, 182, 0.28);
}

.clientes-tabs-container {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.clientes-tabs-header {
  min-height: 48px;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--cli-border);
  background: transparent;
}

.clientes-tabs-header .tab-button {
  min-height: 48px;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.clientes-tabs-header .tab-button.active {
  border-bottom-color: var(--cli-purple);
  background: transparent;
  color: var(--cli-purple);
  box-shadow: none;
}

.clientes-tabs-content {
  padding: 0;
  background: transparent;
}

.clientes-content-card {
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 1px solid var(--cli-border);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(46, 16, 101, 0.05);
  background: var(--surface);
}

.clientes-content-card:hover {
  transform: none;
  box-shadow: 0 10px 28px rgba(46, 16, 101, 0.05);
}

.clientes-content-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--cli-border);
  background: #fcfbfe;
}

.clientes-content-card__heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.clientes-content-card__heading h1 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-page-title);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.clientes-content-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 0 0 auto;
}

.clientes-content-card .clientes-toolbar {
  margin: 0;
  padding: 16px 20px 10px;
  border-bottom: 0;
  background: #fcfbfe;
}

.clientes-content-card .clientes-alphabet {
  margin: 0;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--cli-border);
  background: #fcfbfe;
}

.clientes-content-card .clientes-filtros-panel {
  margin: 0;
  padding: 14px 20px;
  border: 0;
  border-bottom: 1px solid var(--cli-border);
  border-radius: 0;
  background: #fcfbfe;
}

.clientes-content-card .clientes-table-wrap {
  border: 0;
  border-radius: 0;
}

.clientes-content-card .clientes-table-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--cli-border);
  background: #fcfbfe;
}

.clientes-form-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.clientes-content-card.clientes-form-card:hover {
  transform: none;
  box-shadow: none;
}

.clientes-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin-bottom: 0;
}

.clientes-alphabet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--cli-border);
}

.clientes-alphabet__btn {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid #e2e5ee;
  border-radius: 7px;
  background: #fff;
  color: #5b6578;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.clientes-alphabet__btn:hover {
  border-color: #c4b0e4;
  background: #faf8ff;
  color: var(--cli-purple);
}

.clientes-alphabet__btn.is-active {
  border-color: var(--cli-purple);
  background: var(--cli-purple);
  color: #fff;
}

.clientes-alphabet__btn[data-letra=""] {
  min-width: 48px;
  padding: 0 8px;
}

.clientes-toolbar-field,
.clientes-toolbar-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.clientes-toolbar-field > span,
.clientes-toolbar-filter > span {
  color: #687386;
  font-size: var(--text-meta);
  font-weight: 750;
}

.clientes-toolbar-field--search {
  min-width: 0;
}

.clientes-search {
  position: relative;
  width: 100%;
  display: block;
}

.clientes-search i {
  position: absolute;
  top: 50%;
  left: 12px;
  color: #8a94a6;
  font-size: 12px;
  transform: translateY(-50%);
}

.clientes-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 35px;
  border: 1px solid #dfe2eb;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  outline: 0;
  box-sizing: border-box;
}

.clientes-search input:focus {
  border-color: #9d74de;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.08);
}

.clientes-toolbar-filter select {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid #dfe2eb;
  border-radius: 8px;
  background: var(--surface);
  color: #4b5565;
  font-size: 12px;
  outline: 0;
  box-sizing: border-box;
}

.clientes-toolbar-filter select:focus {
  border-color: #9d74de;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.08);
}

.clientes-filter-button,
.clientes-export-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #d9dce7;
  border-radius: 8px;
  background: var(--surface);
  color: #4b5565;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.clientes-filter-button {
  color: var(--cli-purple);
}

.clientes-export-button {
  margin-left: auto;
}

.clientes-filter-button:hover,
.clientes-export-button:hover {
  border-color: #bba4df;
  background: #faf8ff;
}

.clientes-filtros-panel {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--cli-border);
  border-radius: 10px;
  background: rgba(250, 250, 253, 0.86);
}

.clientes-filtros-panel[hidden] {
  display: none;
}

.clientes-filtros-panel label {
  width: min(230px, 100%);
}

.clientes-filtros-panel label > span {
  display: block;
  margin-bottom: 6px;
  color: #687386;
  font-size: var(--text-meta);
  font-weight: 750;
}

.clientes-filtros-panel select {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #dfe2eb;
  border-radius: 7px;
  background: var(--surface);
  color: #4b5565;
  font-size: 11px;
  outline: 0;
}

.clientes-filtros-panel > button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #dfe2eb;
  border-radius: 7px;
  background: var(--surface);
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.clientes-table-wrap {
  width: 100%;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--cli-border);
  border-radius: 10px;
  background: var(--surface);
}

.clientes-table {
  width: 100%;
  min-width: 950px;
  border-collapse: separate;
  border-spacing: 0;
}

.clientes-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px;
  border-bottom: 1px solid var(--cli-border);
  background: #fafafe;
  color: #697386;
  font-size: var(--text-meta);
  font-weight: 800;
  letter-spacing: 0.035em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: 0 1px 0 var(--cli-border);
}

.clientes-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #ececf3;
  color: #344054;
  font-size: 11.5px;
  line-height: 1.45;
  vertical-align: middle;
}

.clientes-table tbody td.clientes-cadastrado {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #5b6475;
  font-size: 12px;
}

.clientes-table tbody tr:last-child td {
  border-bottom: 0;
}

.clientes-table tbody tr:hover td {
  background: #fcfbff;
}

.clientes-nome-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.clientes-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eee9ff;
  color: var(--cli-purple);
  font-size: 11px;
}

.clientes-nome {
  color: #202838;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.clientes-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.clientes-whatsapp i {
  color: #25d366;
  font-size: 12px;
}

/* Cores por origem: variáveis definidas em js/origem-colors.js (aplicarBadge). */
.clientes-origem {
  --origem-rgb: 148, 163, 184;
  --origem-cor-escura: #475569;
  --origem-cor-clara: #cbd5e1;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(var(--origem-rgb), 0.3);
  border-radius: 999px;
  background: rgba(var(--origem-rgb), 0.13);
  color: var(--origem-cor-escura);
  font-size: var(--text-meta);
  font-weight: 700;
}

:is([data-theme="dark"], [data-theme="blue"]) .clientes-origem {
  border-color: rgba(var(--origem-rgb), 0.45);
  background: rgba(var(--origem-rgb), 0.24);
  color: var(--origem-cor-clara);
}

.clientes-table .table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.clientes-table .table-actions .btn {
  width: 29px;
  height: 29px;
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #dfe2eb;
  border-radius: 6px;
  background: #fff;
  color: #344054;
  font-size: 11px;
  box-shadow: none;
}

.clientes-table .table-actions .btn-primary {
  border-color: var(--cli-purple);
  background: var(--cli-purple);
  color: #fff;
}

.clientes-table .table-actions .btn-danger {
  border-color: #fecaca;
  background: #fff;
  color: #ef4444;
}

.clientes-table .table-actions .btn:hover {
  transform: translateY(-1px);
}

.clientes-empty {
  padding: 32px !important;
  color: var(--text-light) !important;
  text-align: center !important;
}

.clientes-table-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 0;
  color: #6f7a8d;
  font-size: var(--text-meta);
}

.clientes-table-footer__right {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

.clientes-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #687386;
  font-size: var(--text-meta);
  font-weight: 700;
  white-space: nowrap;
}

.clientes-page-size select {
  min-width: 64px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #dfe2eb;
  border-radius: 7px;
  background: #fff;
  color: #4b5565;
  font-size: var(--text-meta);
  font-weight: 700;
  outline: 0;
  cursor: pointer;
}

.clientes-table-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.clientes-table-footer > span i {
  color: var(--cli-purple);
}

.clientes-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clientes-pagination button,
.clientes-pagination span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dfe2eb;
  border-radius: 7px;
  background: #fff;
  color: #657084;
  font-size: var(--text-meta);
}

.clientes-pagination span {
  border-color: var(--cli-purple);
  background: var(--cli-purple);
  color: #fff;
  font-weight: 800;
}

.clientes-pagination button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#clientes-view #aba-formulario {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 720px) {
  .clientes-content-card__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .clientes-content-card__actions {
    width: 100%;
  }

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

  .clientes-back-button,
  .clientes-new-button {
    width: 100%;
  }

  .clientes-export-button {
    margin-left: 0;
  }

  .clientes-filtros-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .clientes-filtros-panel label {
    width: 100%;
  }
}

:is([data-theme="dark"], [data-theme="blue"]) .clientes-content-card .clientes-toolbar,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-content-card .clientes-alphabet,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-content-card .clientes-filtros-panel,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-content-card .clientes-table-footer {
  background: var(--bg-secondary);
}

:is([data-theme="dark"], [data-theme="blue"]) .clientes-content-card:not(.clientes-form-card) {
  background: var(--surface);
  border-color: var(--border);
}

:is([data-theme="dark"], [data-theme="blue"]) .clientes-table thead th {
  background: var(--bg-secondary);
}

:is([data-theme="dark"], [data-theme="blue"]) .clientes-table,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-search input,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-filter-button,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-export-button,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-filtros-panel select,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-filtros-panel > button,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-alphabet__btn,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-page-size select,
:is([data-theme="dark"], [data-theme="blue"]) .clientes-pagination button {
  background: var(--surface);
  color: var(--text);
}
