* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6fb;
  color: #101828;
}

button, input, select {
  font-family: inherit;
}

button {
  border: 0;
  background: #155eef;
  color: white;
  padding: 9px 13px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: #0f4ed3;
}

button.secondary {
  background: #eef4ff;
  color: #155eef;
}

button.small {
  padding: 6px 9px;
  font-size: 12px;
}

input, select {
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  padding: 9px 11px;
  background: white;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: white;
  border-right: 1px solid #e4e7ec;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 8px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #155eef;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: #155eef;
  font-size: 17px;
}

.brand span {
  display: block;
  color: #667085;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  background: transparent;
  color: #344054;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-item:hover,
.nav-item.active {
  background: #eef4ff;
  color: #155eef;
}

.badge {
  background: #d92d20;
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  float: right;
}

.hidden {
  display: none;
}

.support-box {
  margin-top: auto;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.support-box small {
  color: #667085;
}

.main {
  min-width: 0;
}

.topbar {
  height: 74px;
  background: white;
  border-bottom: 1px solid #e4e7ec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  gap: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 4px 0 0;
  color: #667085;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.search {
  width: 310px;
}

.token-input {
  width: 260px;
}

.content {
  padding: 18px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: white;
  border: 1px solid #e4e7ec;
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 9px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 3px;
}

.stat-label {
  color: #475467;
  font-size: 13px;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(650px, 1.4fr) minmax(420px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.left-panel,
.right-panel {
  display: grid;
  gap: 14px;
}

.right-panel {
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding-right: 4px;
}

.card {
  background: white;
  border: 1px solid #e4e7ec;
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.card h2,
.card h3 {
  margin: 0 0 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.filters {
  display: flex;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: #667085;
  font-size: 12px;
  border-bottom: 1px solid #e4e7ec;
  padding: 11px 9px;
}

td {
  border-bottom: 1px solid #eef2f6;
  padding: 13px 9px;
  vertical-align: top;
}

tr.client-row {
  cursor: pointer;
}

tr.client-row:hover,
tr.client-row.selected {
  background: #eef4ff;
}

.client-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: #155eef;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #155eef;
  color: white;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}

.status-pill,
.pill {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
}

.pill.gray {
  background: #f2f4f7;
  color: #475467;
  border-color: #d0d5dd;
}

.pill.blue {
  background: #eff8ff;
  color: #175cd3;
  border-color: #b2ddff;
}

.pill.red {
  background: #fef3f2;
  color: #b42318;
  border-color: #fecdca;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.list {
  display: grid;
  gap: 9px;
}

.item {
  border: 1px solid #e4e7ec;
  background: #fcfcfd;
  border-radius: 12px;
  padding: 10px;
}

.item-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.item-small {
  color: #667085;
  font-size: 12px;
}

.compact .item {
  padding: 8px 10px;
}

.client-card-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.client-card-left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.client-card h2 {
  margin: 0 0 5px;
}

.client-info-grid {
  margin-top: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 13px;
}

.info-line strong {
  color: #344054;
}

.chat-box {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.message {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid #e4e7ec;
  background: #f9fafb;
}

.message.client {
  background: #ecfdf3;
  border-color: #abefc6;
}

.message.advisor {
  background: #eff8ff;
  border-color: #b2ddff;
}

.message.system {
  background: #f4f3ff;
  border-color: #d9d6fe;
}

.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.doc-item {
  display: flex;
  justify-content: space-between;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
}

.money {
  font-weight: 800;
  color: #155eef;
}

.process-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.step {
  border-top: 3px solid #12b76a;
  padding-top: 6px;
  font-size: 11px;
  color: #475467;
}

.error {
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #fecdca;
  border-radius: 12px;
  padding: 10px;
}

@media (max-width: 1300px) {
  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .work-area {
    grid-template-columns: 1fr;
  }

  .right-panel {
    max-height: none;
  }
}

@media (max-width: 850px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search,
  .token-input {
    width: 100%;
  }

  .stats-row,
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel V2 polish */
.chat-box {
  max-height: 360px;
  padding-right: 4px;
}

.message {
  line-height: 1.35;
  font-size: 13px;
}

.message .item-small {
  margin-bottom: 5px;
  font-weight: 700;
}

.message.client {
  margin-left: 28px;
}

.message.advisor {
  margin-right: 28px;
}

.message.system {
  font-size: 12px;
  color: #344054;
}

.status-pill,
.pill {
  line-height: 1.2;
  text-align: center;
}

.client-info-grid {
  line-height: 1.35;
}

.item {
  line-height: 1.35;
}

.table-wrap td {
  line-height: 1.25;
}

.right-panel .card {
  scroll-margin-top: 12px;
}

/* Panel V2 right summary polish */
.doc-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.big-number {
  font-size: 26px;
  font-weight: 900;
  color: #155eef;
}

.progress-ring {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  border: 8px solid #12b76a;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #027a48;
  background: white;
}

.doc-item.ok {
  background: #ecfdf3;
  border-color: #abefc6;
}

.doc-item.missing {
  background: #fef3f2;
  border-color: #fecdca;
}

.item.featured {
  background: #f8fbff;
  border-color: #b2ddff;
}

.mini-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  font-size: 12px;
}

.offers-table {
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  overflow: hidden;
}

.offers-head,
.offers-row {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px;
  font-size: 12px;
}

.offers-head {
  background: #f8fafc;
  color: #667085;
  font-weight: 800;
  border-bottom: 1px solid #e4e7ec;
}

.offers-row {
  border-bottom: 1px solid #eef2f6;
}

.offers-row:last-child {
  border-bottom: 0;
}

.selected-offer {
  background: #eef4ff;
  outline: 1px solid #155eef;
}

.business-warning {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #fedf89;
  background: #fffaeb;
  color: #93370d;
  font-weight: 700;
  font-size: 13px;
}

.step.done {
  border-top-color: #12b76a;
  color: #027a48;
  font-weight: 800;
}

.step.active {
  border-top-color: #f79009;
  color: #b54708;
  font-weight: 900;
}

/* SaaS access blocked screen */
.access-block-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, 0.18), transparent 34%),
    linear-gradient(135deg, #0b1220 0%, #182230 50%, #101828 100%);
  padding: 24px;
}

.access-block-card {
  width: min(560px, 100%);
  background: white;
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  text-align: center;
  border: 1px solid #e4e7ec;
}

.access-block-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #155eef;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
}

.access-block-kicker {
  color: #155eef;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.access-block-card h1 {
  margin: 0;
  font-size: 34px;
  color: #101828;
}

.access-block-card p {
  margin: 14px auto 0;
  color: #475467;
  line-height: 1.5;
  max-width: 440px;
  font-size: 16px;
}

.access-block-code {
  margin: 20px auto 0;
  display: inline-flex;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 13px;
}

.access-block-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.access-block-actions button {
  border: 0;
  background: #155eef;
  color: white;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
}

.access-block-actions button.secondary {
  background: #eef2f6;
  color: #344054;
}

@media (max-width: 600px) {
  .access-block-card {
    padding: 26px 20px;
  }

  .access-block-card h1 {
    font-size: 28px;
  }

  .access-block-actions {
    display: grid;
  }
}

/* SaaS access blocked screen */
.access-block-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, 0.18), transparent 34%),
    linear-gradient(135deg, #0b1220 0%, #182230 50%, #101828 100%);
  padding: 24px;
}

.access-block-card {
  width: min(560px, 100%);
  background: white;
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  text-align: center;
  border: 1px solid #e4e7ec;
}

.access-block-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #155eef;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
}

.access-block-kicker {
  color: #155eef;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.access-block-card h1 {
  margin: 0;
  font-size: 34px;
  color: #101828;
}

.access-block-card p {
  margin: 14px auto 0;
  color: #475467;
  line-height: 1.5;
  max-width: 440px;
  font-size: 16px;
}

.access-block-code {
  margin: 20px auto 0;
  display: inline-flex;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 13px;
}

.access-block-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.access-block-actions button {
  border: 0;
  background: #155eef;
  color: white;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
}

.access-block-actions button.secondary {
  background: #eef2f6;
  color: #344054;
}

@media (max-width: 600px) {
  .access-block-card {
    padding: 26px 20px;
  }

  .access-block-card h1 {
    font-size: 28px;
  }

  .access-block-actions {
    display: grid;
  }
}

.login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Acciones rápidas ficha cliente */
.client-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.client-quick-actions .small {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .client-card-main {
    align-items: flex-start;
    gap: 12px;
  }

  .client-quick-actions {
    justify-content: flex-start;
  }
}

/* Ofertas recibidas por mail: lectura completa antes de redactar */
.received-mail-detail {
  grid-column: 1 / -1;
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  background: rgba(15, 23, 42, .55);
}

.received-mail-line {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  margin-bottom: 7px;
  line-height: 1.4;
}

.received-mail-line strong {
  color: var(--text, #e5e7eb);
}

.received-mail-detected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.received-mail-body {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(2, 6, 23, .72);
  color: var(--text, #e5e7eb);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}



/* Alerta importante: documentación de depósito pendiente de revisión */
.alert-important {
  border-width: 2px;
}

.alert-important .item-title {
  font-weight: 800;
}


/* Documentación de depósito en ficha del cliente */
.deposit-documents-review {
  margin-top: 12px;
}

.deposit-docs-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}


/* Acciones de revisión de documentación de depósito */
.deposit-doc-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}


/* Modal propio del CRM para pedir corrección de documentación */
.crm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
}

.crm-modal-card {
  width: min(520px, 100%);
  background: #ffffff;
  color: #111827;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  padding: 20px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.crm-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.crm-modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.crm-modal-subtitle {
  font-size: 13px;
  color: #4b5563;
}

.crm-modal-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #4b5563;
}

.crm-modal-textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  outline: none;
  box-sizing: border-box;
}

.crm-modal-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.crm-modal-error {
  min-height: 20px;
  color: #b91c1c;
  font-size: 13px;
  margin-top: 8px;
}

.crm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}


/* Visor superpuesto de documentos de depósito */
.document-viewer-card {
  width: min(980px, 96vw);
  height: min(760px, 92vh);
  display: flex;
  flex-direction: column;
}

.document-viewer-frame {
  flex: 1;
  min-height: 420px;
  background: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  overflow: hidden;
}

.document-viewer-frame iframe,
.document-viewer-frame img {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.document-viewer-frame img {
  object-fit: contain;
  background: #111827;
}

.document-open-new {
  text-decoration: none;
}


/* Enviar documentación de depósito a financieras */
.deposit-send-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.10);
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.send-financial-card {
  width: min(620px, 96vw);
}

.send-financial-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 2px;
  margin: 10px 0 14px;
}

.financial-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.04);
  cursor: pointer;
}

.financial-checkbox-row:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.06);
}

.financial-checkbox-row input {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: #2563eb;
}

.financial-checkbox-row span {
  display: grid;
  gap: 2px;
}

.financial-checkbox-row strong {
  color: #111827;
  font-size: 14px;
}

.financial-checkbox-row small {
  color: #64748b;
  font-size: 12px;
}

.send-financial-notes-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #374151;
  margin: 8px 0 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* === CRM COMFORT UI V1 START === */

/*
  CRM Créditos PRO SaaS - Comfort UI V1
  Objetivo: panel más cómodo para uso intensivo.
  No toca lógica, no toca scroll funcional congelado.
*/

:root {
  --crm-bg-soft: #f6f8fb;
  --crm-surface: #ffffff;
  --crm-surface-soft: #f9fbff;
  --crm-border-soft: rgba(148, 163, 184, 0.28);
  --crm-border-strong: rgba(37, 99, 235, 0.24);
  --crm-text-main: #0f172a;
  --crm-text-muted: #64748b;
  --crm-blue: #2563eb;
  --crm-blue-dark: #1d4ed8;
  --crm-green: #16a34a;
  --crm-green-soft: rgba(34, 197, 94, 0.11);
  --crm-orange: #ea580c;
  --crm-orange-soft: rgba(249, 115, 22, 0.10);
  --crm-shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.07);
  --crm-shadow-action: 0 8px 18px rgba(37, 99, 235, 0.22);
}

body {
  background: var(--crm-bg-soft);
  color: var(--crm-text-main);
  text-rendering: optimizeLegibility;
}

/* Lectura más cómoda */
h1, h2, h3, h4 {
  letter-spacing: -0.025em;
}

p, li, td, th, input, textarea, select, button {
  line-height: 1.45;
}

/* Cajas principales más suaves */
.card,
.panel,
.section,
.client-card,
.client-detail,
.client-summary,
.summary-card,
.drawer,
.modal-card,
.offer-card,
.deposit-card,
.document-card {
  border-color: var(--crm-border-soft);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

/* Bloques internos: menos ruido, más aire */
.item {
  border-color: var(--crm-border-soft);
  border-radius: 14px;
  background: var(--crm-surface);
  line-height: 1.42;
}

.item:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.055);
}

.item strong,
.item b {
  color: var(--crm-text-main);
}

.item-small,
.muted,
small {
  color: var(--crm-text-muted);
  line-height: 1.35;
}

/* Botones más cómodos para operar muchas horas */
button,
.btn,
.primary,
.secondary {
  border-radius: 11px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

button.small,
.btn.small,
.primary.small,
.secondary.small {
  min-height: 32px;
  padding: 7px 12px;
}

button.primary,
.primary {
  background: linear-gradient(180deg, var(--crm-blue), var(--crm-blue-dark));
  box-shadow: var(--crm-shadow-action);
  border: 1px solid rgba(29, 78, 216, 0.28);
}

button.primary:hover,
.primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

button.secondary,
.secondary {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid var(--crm-border-soft);
}

button.secondary:hover,
.secondary:hover {
  background: #f8fafc;
  border-color: rgba(37, 99, 235, 0.35);
}

/* Estados más limpios */
.status-pill,
.badge,
.pill {
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Documentación de depósito: área de trabajo visual */
.deposit-documents-review {
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid var(--crm-border-soft);
}

.deposit-docs-list {
  display: grid;
  gap: 10px;
}

.deposit-docs-list .item {
  padding: 12px;
}

.deposit-doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

/* Acción final: lista para enviar */
.deposit-send-box {
  border-radius: 16px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  background:
    linear-gradient(180deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.07));
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.08);
  padding: 13px 14px;
}

.deposit-send-box strong {
  font-size: 14px;
  color: #14532d;
}

.deposit-send-box .item-small {
  color: #3f6f52;
}

/* Visor de documentos y modales: más premium */
.crm-modal-backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.crm-modal-card {
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.crm-modal-title {
  letter-spacing: -0.025em;
}

.crm-modal-subtitle {
  color: var(--crm-text-muted);
}

.crm-modal-textarea,
input,
textarea,
select {
  border-radius: 12px;
}

.crm-modal-textarea:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Modal de financieras */
.send-financial-card {
  border-radius: 20px;
}

.financial-checkbox-row {
  transition: 0.15s ease;
}

.financial-checkbox-row:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

/* Tablas/listas más respirables */
table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  color: #475569;
  font-weight: 800;
}

td {
  color: #1f2937;
}

/* Cansancio visual: suaviza separaciones */
hr {
  border: 0;
  border-top: 1px solid var(--crm-border-soft);
}

/* Responsive chico sin romper layout */
@media (max-width: 760px) {
  .deposit-send-box {
    align-items: stretch;
  }

  .deposit-send-box button {
    width: 100%;
  }

  .deposit-doc-actions {
    justify-content: flex-start;
  }
}

/* === CRM COMFORT UI V1 END === */

/* === CRM COMFORT UI V2 WORKBENCH START === */

/*
  CRM Créditos PRO SaaS - Comfort UI V2
  Objetivo: que el panel se sienta como mesa de trabajo diaria.
  Solo estética. No toca lógica ni scroll funcional congelado.
*/

/* Layout general más respirable */
main,
.main,
.main-content,
.content,
.dashboard-content {
  background: #f6f8fb;
}

/* Header superior: menos pesado, más profesional */
header,
.topbar,
.header,
.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

header h1,
.topbar h1,
.header h1,
.app-header h1 {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

header p,
.topbar p,
.header p,
.app-header p {
  color: #64748b;
}

/* Inputs superiores más prolijos */
header input,
.topbar input,
.header input,
.app-header input {
  min-height: 39px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: #ffffff;
}

/* Sidebar: más limpio, menos ruido visual */
.sidebar,
.side-nav,
nav {
  border-right: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.sidebar a,
.sidebar button,
.side-nav a,
.side-nav button,
nav a,
nav button {
  border-radius: 12px;
  transition: 0.15s ease;
}

.sidebar a:hover,
.sidebar button:hover,
.side-nav a:hover,
.side-nav button:hover,
nav a:hover,
nav button:hover {
  background: rgba(37, 99, 235, 0.08);
}

/* Tarjetas de métricas: compactas para liberar espacio operativo */
.stats-grid,
.metrics-grid,
.kpi-grid,
.dashboard-stats {
  gap: 12px !important;
}

.stat-card,
.metric-card,
.kpi-card,
.dashboard-card {
  min-height: 96px;
  padding: 18px 16px !important;
  border-radius: 17px !important;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055) !important;
}

.stat-card .number,
.metric-card .number,
.kpi-card .number,
.dashboard-card .number,
.stat-value,
.metric-value,
.kpi-value {
  font-size: 27px !important;
  line-height: 1 !important;
  letter-spacing: -0.05em;
}

.stat-card small,
.metric-card small,
.kpi-card small,
.dashboard-card small {
  color: #475569;
  font-weight: 650;
}

/* Bloque Clientes: más tipo bandeja de trabajo */
.clients,
.clients-card,
.clients-section,
.client-list-card,
.table-card {
  border-radius: 18px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.055) !important;
  background: #ffffff;
}

.clients h2,
.clients-card h2,
.clients-section h2,
.table-card h2 {
  font-size: 24px;
  letter-spacing: -0.04em;
}

/* Tabla de clientes: mejor lectura */
table {
  font-size: 13px;
}

thead th {
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

tbody tr {
  transition: 0.14s ease;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.055) !important;
}

tbody td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

/* Cliente seleccionado: más claro */
tbody tr.selected,
tbody tr.active,
.client-row.selected,
.client-row.active {
  background: rgba(37, 99, 235, 0.09) !important;
  outline: 1px solid rgba(37, 99, 235, 0.16);
}

/* Panel derecho del cliente: convertirlo en ficha de trabajo */
.client-detail,
.client-panel,
.client-summary,
.client-profile,
.selected-client,
.customer-panel {
  border-radius: 18px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  background: #ffffff !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.075) !important;
}

.client-detail h2,
.client-panel h2,
.client-summary h2,
.client-profile h2,
.selected-client h2,
.customer-panel h2 {
  font-size: 25px !important;
  line-height: 1.05 !important;
  letter-spacing: -0.05em;
}

/* Botones rápidos del cliente: más operativos */
.client-detail button,
.client-panel button,
.client-summary button,
.client-profile button,
.selected-client button,
.customer-panel button {
  white-space: nowrap;
}

/* Conversation/chat: menos cansancio visual */
.conversation,
.chat-card,
.messages-card,
.client-chat {
  border-radius: 18px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.conversation h3,
.chat-card h3,
.messages-card h3,
.client-chat h3 {
  font-size: 19px;
  letter-spacing: -0.04em;
}

/* Mensajes más legibles */
.message,
.chat-message,
.bubble {
  border-radius: 14px !important;
  line-height: 1.45;
}

/* Alertas y actividad: que no griten todas igual */
.alerts,
.activity,
.alerts-card,
.activity-card,
.recent-activity {
  border-radius: 18px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.alerts h2,
.activity h2,
.alerts-card h2,
.activity-card h2,
.recent-activity h2 {
  font-size: 22px;
  letter-spacing: -0.04em;
}

/* Items internos: menos borde duro */
.alert-item,
.activity-item,
.item {
  border-radius: 15px !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

/* Badges: estado más premium */
.status-pill,
.badge,
.pill {
  padding: 4px 10px;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* Botón final “Ver y enviar”: acción protagonista */
.deposit-send-box .primary,
.deposit-send-box button.primary {
  min-height: 38px;
  padding: 9px 16px;
  border-radius: 13px;
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

/* “Documentación aprobada” más claro */
.deposit-send-box {
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.13), rgba(37, 99, 235, 0.06));
  border-color: rgba(34, 197, 94, 0.30) !important;
}

/* Scrollbar más discreta, menos vieja */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8);
}

*::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.42);
  border-radius: 999px;
  border: 2px solid rgba(241, 245, 249, 0.8);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.55);
}

/* Ajuste visual para pantallas anchas */
@media (min-width: 1180px) {
  .stat-card,
  .metric-card,
  .kpi-card,
  .dashboard-card {
    min-height: 92px;
  }

  .client-detail,
  .client-panel,
  .client-summary,
  .client-profile,
  .selected-client,
  .customer-panel {
    position: relative;
  }
}

/* Evita que botones chicos parezcan pegados */
button + button,
.btn + .btn,
.primary + .secondary,
.secondary + .primary {
  margin-left: 4px;
}

/* === CRM COMFORT UI V2 WORKBENCH END === */

/* === CRM COMFORT UI V3 CLIENT WORKSPACE START === */

/*
  CRM Créditos PRO SaaS - Comfort UI V3
  Objetivo: mejorar el panel derecho del cliente como espacio de trabajo.
  Solo estética. No toca lógica ni scroll funcional congelado.
*/

/* Panel derecho: más protagonismo de ficha operativa */
.client-detail,
.client-panel,
.client-summary,
.client-profile,
.selected-client,
.customer-panel {
  overflow: hidden;
}

/* Encabezado del cliente: más claro y vendedor */
.client-detail > div:first-child,
.client-panel > div:first-child,
.client-summary > div:first-child,
.client-profile > div:first-child,
.selected-client > div:first-child,
.customer-panel > div:first-child {
  border-bottom: 1px solid rgba(148, 163, 184, 0.20);
}

/* Nombre del cliente más potente, sin quedar tosco */
.client-detail h2,
.client-panel h2,
.client-summary h2,
.client-profile h2,
.selected-client h2,
.customer-panel h2 {
  color: #0f172a;
  text-wrap: balance;
}

/* Avatar del cliente: más CRM premium */
.avatar,
.client-avatar,
.initials,
.user-avatar {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.20);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

/* Datos del cliente: formato más legible */
.client-detail strong,
.client-panel strong,
.client-summary strong,
.client-profile strong,
.selected-client strong,
.customer-panel strong {
  color: #0f172a;
}

.client-detail .item-small,
.client-panel .item-small,
.client-summary .item-small,
.client-profile .item-small,
.selected-client .item-small,
.customer-panel .item-small {
  color: #64748b;
}

/* Botones rápidos del cliente: que parezcan herramientas de trabajo */
.client-detail button,
.client-panel button,
.client-summary button,
.client-profile button,
.selected-client button,
.customer-panel button {
  min-height: 34px;
}

.client-detail button.primary,
.client-panel button.primary,
.client-summary button.primary,
.client-profile button.primary,
.selected-client button.primary,
.customer-panel button.primary {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.20);
}

/* WhatsApp como acción principal visual */
button[onclick*="WhatsApp"],
button[onclick*="whatsapp"],
a[href*="wa.me"],
a[href*="web.whatsapp"] {
  background: linear-gradient(180deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: rgba(29, 78, 216, 0.30) !important;
}

/* Conversación: más cómoda para leer durante horas */
.conversation,
.chat-card,
.messages-card,
.client-chat {
  margin-top: 14px;
}

/* Título conversación más limpio */
.conversation h3,
.chat-card h3,
.messages-card h3,
.client-chat h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Mensajes tipo burbuja más descansados */
.message,
.chat-message,
.bubble,
.conversation .item,
.chat-card .item,
.messages-card .item,
.client-chat .item {
  background: #f8f7ff;
  border-color: rgba(129, 140, 248, 0.22) !important;
  color: #1e1b4b;
}

/* Mensajes sistema: menos invasivos */
.message small,
.chat-message small,
.bubble small,
.conversation small,
.chat-card small,
.messages-card small,
.client-chat small {
  color: #64748b;
}

/* Depósito / Liquidación: convertirlo en bloque de etapa */
.deposit-card,
.deposit-section,
.deposit-documents-review,
.deposit-send-box {
  position: relative;
}

/* Título de documentación de depósito más visible */
.deposit-documents-review > strong,
.deposit-documents-review h3,
.deposit-documents-review h4 {
  letter-spacing: -0.035em;
}

/* Documentos aprobados: que respiren y se lean rápido */
.deposit-docs-list .item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

/* Botones dentro de documentos: que no parezcan sueltos */
.deposit-doc-actions button,
.deposit-docs-list button {
  min-height: 31px;
  border-radius: 999px;
}

/* El botón Ver PDF / archivo queda como herramienta secundaria elegante */
.deposit-docs-list button.secondary,
.deposit-doc-actions button.secondary {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.26);
  color: #1d4ed8;
}

/* Botón Ver y enviar: foco final */
.deposit-send-box {
  margin-top: 14px;
}

.deposit-send-box button {
  font-weight: 900;
}

/* Línea de progreso: más nítida, menos juguete */
.progress,
.steps,
.stage-line,
.workflow-line {
  filter: saturate(0.95);
}

.progress span,
.steps span,
.stage-line span,
.workflow-line span {
  font-weight: 800;
}

/* Alertas: destacar lo que es acción real */
.alert-important,
.alert-item.featured,
.item.featured {
  border-color: rgba(249, 115, 22, 0.38) !important;
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.95), rgba(255, 255, 255, 0.95)) !important;
}

/* Actividad reciente: más tipo timeline */
.activity .item,
.activity-card .item,
.recent-activity .item {
  position: relative;
  padding-left: 15px;
}

.activity .item::before,
.activity-card .item::before,
.recent-activity .item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 4px;
  height: calc(100% - 28px);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.20);
}

/* Cliente seleccionado en tabla: más visible sin gritar */
tbody tr:hover td {
  color: #0f172a;
}

/* Evita fatiga por negro puro en textos secundarios */
td,
.item,
.alert-item,
.activity-item {
  color: #1f2937;
}

/* Separación vertical general en columnas */
.dashboard-grid,
.main-grid,
.content-grid {
  gap: 16px !important;
}

/* En pantallas grandes, que el panel derecho se sienta más estable */
@media (min-width: 1180px) {
  .client-detail,
  .client-panel,
  .client-summary,
  .client-profile,
  .selected-client,
  .customer-panel {
    min-width: 390px;
  }
}

/* En pantallas chicas, no romper */
@media (max-width: 760px) {
  .deposit-docs-list .item {
    grid-template-columns: 1fr;
  }

  .client-detail button,
  .client-panel button,
  .client-summary button,
  .client-profile button,
  .selected-client button,
  .customer-panel button {
    width: auto;
  }
}

/* === CRM COMFORT UI V3 CLIENT WORKSPACE END === */

/* === CRM COMFORT UI V4 DENSITY PRO START === */

/*
  CRM Créditos PRO SaaS - Comfort UI V4
  Objetivo: más eficiencia visual para uso diario.
  Solo estética. No toca lógica ni scroll funcional congelado.
*/

/* Más densidad útil sin volver al panel viejo apretado */
body {
  font-size: 14px;
}

/* Topbar más compacta */
header,
.topbar,
.header,
.app-header {
  min-height: 72px;
}

header h1,
.topbar h1,
.header h1,
.app-header h1 {
  margin-bottom: 3px;
}

/* Buscador y token: menos protagonistas que el trabajo */
header input,
.topbar input,
.header input,
.app-header input {
  box-shadow: none;
}

header button,
.topbar button,
.header button,
.app-header button {
  min-height: 38px;
}

/* Sidebar: navegación más cómoda */
.sidebar,
.side-nav,
nav {
  font-size: 14px;
}

.sidebar a,
.sidebar button,
.side-nav a,
.side-nav button,
nav a,
nav button {
  min-height: 40px;
  padding-top: 9px;
  padding-bottom: 9px;
}

/* KPI arriba: compactos y escaneables */
.stat-card,
.metric-card,
.kpi-card,
.dashboard-card {
  min-height: 86px !important;
  padding: 15px 16px !important;
}

.stat-card .number,
.metric-card .number,
.kpi-card .number,
.dashboard-card .number,
.stat-value,
.metric-value,
.kpi-value {
  font-size: 25px !important;
}

.stat-card small,
.metric-card small,
.kpi-card small,
.dashboard-card small {
  font-size: 13px;
}

/* Clientes: tabla más cómoda para leer rápido */
.clients table,
.clients-card table,
.clients-section table,
.table-card table {
  width: 100%;
}

thead th {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

tbody td {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

tbody tr {
  cursor: pointer;
}

/* Avatar del cliente en tabla más elegante */
td .avatar,
td .client-avatar,
td .initials,
td .user-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

/* Estados: más legibles y menos toscos */
.status-pill,
.badge,
.pill {
  font-size: 12px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Bloques de alertas y actividad: menos caja pesada */
.alerts .item,
.activity .item,
.alerts-card .item,
.activity-card .item,
.recent-activity .item {
  padding: 12px 13px !important;
}

.alerts .item strong,
.activity .item strong,
.alerts-card .item strong,
.activity-card .item strong,
.recent-activity .item strong {
  font-size: 15px;
}

/* Jerarquía: alertas operativas no deben parecer documentos */
.alerts .item {
  background: #ffffff;
}

.alerts .item:hover,
.activity .item:hover,
.recent-activity .item:hover {
  transform: translateY(-1px);
}

/* Panel cliente derecho: botones y datos más ordenados */
.client-detail,
.client-panel,
.client-summary,
.client-profile,
.selected-client,
.customer-panel {
  font-size: 14px;
}

.client-detail h2,
.client-panel h2,
.client-summary h2,
.client-profile h2,
.selected-client h2,
.customer-panel h2 {
  margin-bottom: 6px;
}

.client-detail .status-pill,
.client-panel .status-pill,
.client-summary .status-pill,
.client-profile .status-pill,
.selected-client .status-pill,
.customer-panel .status-pill {
  margin-top: 3px;
}

/* Datos del cliente: menos sensación de texto suelto */
.client-detail p,
.client-panel p,
.client-summary p,
.client-profile p,
.selected-client p,
.customer-panel p {
  margin-top: 5px;
  margin-bottom: 5px;
}

/* Conversación: más compacta pero legible */
.conversation .item,
.chat-card .item,
.messages-card .item,
.client-chat .item {
  padding: 10px 12px !important;
}

.conversation h3,
.chat-card h3,
.messages-card h3,
.client-chat h3 {
  margin-bottom: 10px;
}

/* Depósito: el bloque final queda más premium */
.deposit-send-box {
  min-height: 58px;
}

.deposit-send-box .primary,
.deposit-send-box button.primary {
  min-width: 126px;
}

/* Documentos: mejor lectura de nombre + acción */
.deposit-docs-list .item {
  min-height: 62px;
}

.deposit-docs-list .item-small {
  font-size: 12px;
}

/* Botón Ver PDF / archivo como acción clara */
.deposit-docs-list button.secondary {
  font-weight: 850;
}

/* Formularios y selects más pulidos */
select,
input,
textarea {
  font-size: 14px;
}

select {
  cursor: pointer;
}

/* Botones: quitar sensación de juguete */
button,
.btn,
.primary,
.secondary {
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease;
}

button:active,
.btn:active,
.primary:active,
.secondary:active {
  transform: translateY(0);
}

/* Enfoque teclado/mouse más pro */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

/* Modal de financieras: más claro para seleccionar varias */
.send-financial-list {
  gap: 8px;
}

.financial-checkbox-row {
  min-height: 56px;
}

.financial-checkbox-row input {
  flex: 0 0 auto;
}

.financial-checkbox-row strong {
  font-size: 13.5px;
}

.financial-checkbox-row small {
  font-size: 12px;
}

/* Visor PDF: más escritorio, menos popup */
.document-viewer-card {
  border-radius: 20px;
}

.document-viewer-frame {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* Reducir ruido de bordes en general */
.card,
.panel,
.section,
.item,
.alert-item,
.activity-item {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.045);
}

/* Hover suave para tarjetas importantes */
.card:hover,
.panel:hover,
.section:hover,
.client-detail:hover,
.client-panel:hover,
.client-summary:hover,
.selected-client:hover,
.customer-panel:hover {
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.065);
}

/* Evitar que hover moleste en modales */
.crm-modal-card:hover {
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

/* Responsive: si baja de ancho, preservar operación */
@media (max-width: 900px) {
  .stat-card,
  .metric-card,
  .kpi-card,
  .dashboard-card {
    min-height: 82px !important;
  }

  .deposit-send-box {
    gap: 10px;
  }
}

/* === CRM COMFORT UI V4 DENSITY PRO END === */


/* === HIDE UGLY RECEIVED OFFER BLOCK START === */

/*
  Oculta el bloque visual crudo de ofertas recibidas.
  No borra datos. No toca backend.
  La oferta recibida sigue existiendo en DB, pero no ensucia la ficha principal.
*/

/* Bloques típicos de oferta recibida / mail crudo */
.received-offers,
.received-offers-section,
.received-offer-card,
.received-offer-raw,
.received-offer-body,
.raw-offer,
.raw-offer-card,
.email-offer-card,
.detected-offer-card,
.offer-detection-card {
  display: none !important;
}

/* Si alguna tarjeta vieja quedó marcada como bloque de mail/oferta cruda */
.item.received-offer,
.item.raw-offer,
.item.email-offer,
.card.received-offer,
.card.raw-offer,
.card.email-offer {
  display: none !important;
}

/* Mantener visibles las ofertas formales */
.formal-offers,
.formal-offers-section,
.offer-formal,
.formal-offer-card {
  display: block !important;
}

/* === HIDE UGLY RECEIVED OFFER BLOCK END === */

/* === NATIVE CLIENT PANEL TOGGLE CSS START === */

/* Oculta el panel derecho real del cliente completo */
.client-detail-panel-hidden {
  display: none !important;
}

/* El header real de la ficha sostiene la X nativa */
#clientHeader {
  position: relative;
}

/* X prolija, centrada dentro de la ficha del cliente */
.client-native-close-button {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(255, 255, 255, 0.98);
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.client-native-close-button span {
  display: block;
  line-height: 1;
  font-size: 22px;
  font-weight: 900;
  transform: translateY(-1px);
}

.client-native-close-button:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.42);
}

/* Por seguridad, matar restos visuales de parches viejos */
.show-client-summary-button,
.client-summary-close-button,
.full-client-panel-close-button,
.client-workspace-column-close-button,
.client-workspace-toggle-close-button {
  display: none !important;
}

/* === NATIVE CLIENT PANEL TOGGLE CSS END === */

/* === RIGHT PANEL REAL ASIDE FIX START === */

/* Oculta o muestra el aside completo del panel derecho */
#clientDetailPanel.client-detail-panel-hidden,
.right-panel.client-detail-panel-hidden {
  display: none !important;
}

/* Header de ficha con X nativa */
#clientHeader {
  position: relative;
}

.client-native-close-button {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(255, 255, 255, 0.98);
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.client-native-close-button span {
  display: block;
  line-height: 1;
  font-size: 22px;
  font-weight: 900;
  transform: translateY(-1px);
}

.client-native-close-button:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.42);
}

/* === RIGHT PANEL REAL ASIDE FIX END === */

/* === CLIENT MODAL START === */
.client-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.client-modal-overlay.client-detail-panel-hidden {
  display: none !important;
}
.client-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  animation: cmFade 0.2s ease;
}
@keyframes cmFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cmSlide {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.client-modal-container {
  position: relative;
  background: var(--crm-surface);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  animation: cmSlide 0.25s ease;
}
.client-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--crm-border-soft);
  background: var(--crm-surface);
  color: var(--crm-text-muted);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  min-height: auto;
}
.client-modal-close:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.42);
}
.client-modal-header {
  padding: 20px 24px 16px;
}
.client-modal-header .card {
  margin: 0;
  box-shadow: none;
  border: none;
  background: transparent;
}
.client-modal-header .client-card-main {
  padding-right: 40px;
}
.client-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  border-top: 1px solid var(--crm-border-soft);
}
.client-modal-nav {
  width: 190px;
  min-width: 190px;
  border-right: 1px solid var(--crm-border-soft);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--crm-bg-soft);
  overflow-y: auto;
}
.client-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border: none;
  background: transparent;
  color: var(--crm-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  min-height: auto;
  border-right: 3px solid transparent;
}
.client-tab:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--crm-text-main);
}
.client-tab.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--crm-blue);
  border-right-color: var(--crm-blue);
}
.client-modal-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
}
.client-panel {
  display: none;
}
.client-panel.active {
  display: block;
}
/* Resumen cards */
.resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.resumen-card {
  background: var(--crm-bg-soft);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.resumen-card:hover {
  border-color: var(--crm-blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}
.resumen-card-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.resumen-card-label {
  font-size: 11px;
  color: var(--crm-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.resumen-card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--crm-text-main);
  line-height: 1.2;
}
.resumen-card-detail {
  font-size: 12px;
  color: var(--crm-text-muted);
  margin-top: 6px;
}
.resumen-card-progress {
  height: 6px;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.resumen-card-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.resumen-card-progress-bar.green { background: var(--crm-green); }
.resumen-card-progress-bar.blue { background: var(--crm-blue); }
.resumen-card-progress-bar.orange { background: var(--crm-orange); }
/* Hide old close button inside modal */
.client-modal-container .client-native-close-button {
  display: none !important;
}
body.client-modal-open {
  overflow: hidden;
}
/* Work area now always single column (modal is overlay) */
.work-area {
  grid-template-columns: 1fr !important;
}
@media (max-width: 700px) {
  .client-modal-overlay { padding: 0; }
  .client-modal-container { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .client-modal-body { flex-direction: column; }
  .client-modal-nav {
    width: 100%; min-width: auto;
    flex-direction: row; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--crm-border-soft);
    padding: 8px; gap: 0;
  }
  .client-tab {
    white-space: nowrap; padding: 10px 14px; font-size: 12px;
    border-right: none; border-bottom: 3px solid transparent;
  }
  .client-tab.active { border-right-color: transparent; border-bottom-color: var(--crm-blue); }
  .resumen-grid { grid-template-columns: repeat(2, 1fr); }
}
/* === CLIENT MODAL END === */

/* === MODAL POLISH START === */
/* Scroll shadow - appears only when content overflows */
.client-modal-content {
  background:
    linear-gradient(var(--crm-surface) 33%, transparent),
    linear-gradient(transparent, var(--crm-surface) 66%) 0 100%,
    radial-gradient(farthest-side at 50% 0, rgba(15,23,42,0.08), transparent),
    radial-gradient(farthest-side at 50% 100%, rgba(15,23,42,0.08), transparent) 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 20px, 100% 20px, 100% 6px, 100% 6px;
  background-attachment: local, local, scroll, scroll;
}
/* Resumen cards that need attention */
.resumen-card.needs-attention {
  border-left: 3px solid var(--crm-orange);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.04), var(--crm-bg-soft));
}
.resumen-card.needs-attention:hover {
  border-color: var(--crm-orange);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.15);
}
/* === MODAL POLISH END === */

/* === OFFER DRAFT FORM START === */
.offer-draft {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.offer-draft-back {
  align-self: flex-start;
}
.offer-draft-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--crm-text-main);
}
.offer-draft-email {
  background: var(--crm-bg-soft);
  border: 1px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
}
.offer-draft-email-line {
  margin-bottom: 6px;
  line-height: 1.4;
}
.offer-draft-email-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--crm-border-soft);
  white-space: pre-wrap;
  color: var(--crm-text-muted);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}
.offer-draft-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.offer-draft-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-text-muted);
  margin-bottom: 4px;
}
.offer-draft-field input {
  width: 100%;
}
.offer-draft-hint {
  font-size: 12px;
  color: var(--crm-text-muted);
  margin: 0 0 8px;
}
#offerDraftMessage {
  width: 100%;
  min-height: 220px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 14px;
  resize: vertical;
  background: var(--crm-surface);
  color: var(--crm-text-main);
}
#offerDraftMessage:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.offer-draft-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}
/* === OFFER DRAFT FORM END === */

/* === OFFER DRAFT POLISH START === */
.offer-draft {
  gap: 24px;
}
.offer-draft-back {
  align-self: flex-start;
  font-size: 13px;
  color: var(--crm-blue);
  border-color: transparent;
  padding-left: 0;
  background: transparent;
}
.offer-draft-back:hover {
  background: transparent;
  color: var(--crm-blue-dark);
  text-decoration: underline;
}
.offer-draft-section {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  padding: 20px;
}
.offer-draft-section h4 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--crm-text-main);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--crm-border-soft);
}
.offer-draft-email {
  background: var(--crm-bg-soft);
  border: 1px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 18px;
  font-size: 13px;
  border-left: 4px solid var(--crm-blue);
}
.offer-draft-email-line {
  margin-bottom: 8px;
  line-height: 1.5;
}
.offer-draft-email-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--crm-border-soft);
  white-space: pre-wrap;
  color: var(--crm-text-main);
  line-height: 1.7;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.offer-draft-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}
.offer-draft-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crm-text-muted);
  margin-bottom: 6px;
}
.offer-draft-field input {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 14px;
  border: 2px solid var(--crm-border-soft);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.offer-draft-field input:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.offer-draft-hint {
  font-size: 12px;
  color: var(--crm-text-muted);
  margin: 0 0 10px;
  font-style: italic;
}
#offerDraftMessage {
  width: 100%;
  min-height: 240px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  border: 2px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 16px;
  resize: vertical;
  background: var(--crm-bg-soft);
  color: var(--crm-text-main);
  transition: border-color 0.15s;
}
#offerDraftMessage:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--crm-surface);
}
.offer-draft-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}
.offer-draft-actions .primary {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  box-shadow: var(--crm-shadow-action);
}
.offer-draft-actions .primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.offer-draft-actions .secondary {
  padding: 12px 20px;
  font-size: 14px;
  border-radius: 12px;
}
/* === OFFER DRAFT POLISH END === */

/* === OFFER DRAFT SEND BUTTON === */
.offer-draft-actions .primary {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(29, 78, 216, 0.30);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  color: white;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50px;
  letter-spacing: 0.02em;
}
.offer-draft-actions .primary:hover {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  transform: translateY(-2px);
}

/* === SIDEBAR NAVIGATION + VIEWS START === */
.nav-item {
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: rgba(37, 99, 235, 0.06);
}
.nav-item.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--crm-blue);
  border-right: 3px solid var(--crm-blue);
}
.view-content {
  padding: 0;
}
/* View header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.view-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--crm-text-main);
}
/* View table */
.view-table-wrap {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  overflow: hidden;
}
.view-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.view-table thead {
  background: var(--crm-bg-soft);
}
.view-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-text-muted);
  border-bottom: 1px solid var(--crm-border-soft);
}
.view-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--crm-border-soft);
  color: var(--crm-text-main);
  vertical-align: middle;
}
.view-table tbody tr:last-child td {
  border-bottom: none;
}
.view-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}
.view-table .actions {
  display: flex;
  gap: 8px;
}
/* Financiera form */
.fin-form {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  padding: 28px;
}
.fin-form h3 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--crm-text-main);
}
.fin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.fin-form-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-text-muted);
  margin-bottom: 6px;
}
.fin-form-field input,
.fin-form-field select,
.fin-form-field textarea {
  width: 100%;
  font-size: 14px;
  padding: 10px 14px;
  border: 2px solid var(--crm-border-soft);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.fin-form-field input:focus,
.fin-form-field select:focus,
.fin-form-field textarea:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.fin-form-profiles {
  margin-bottom: 24px;
}
.fin-form-profiles h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--crm-text-main);
}
.fin-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.fin-profile-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--crm-bg-soft);
  border: 1px solid var(--crm-border-soft);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.fin-profile-check:hover {
  border-color: var(--crm-blue);
}
.fin-profile-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--crm-blue);
}
.fin-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
/* Profile badges in table */
.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.profile-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--crm-blue);
  font-weight: 600;
  white-space: nowrap;
}
/* Placeholder view */
.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}
.view-placeholder-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.view-placeholder-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--crm-text-main);
  margin-bottom: 8px;
}
.view-placeholder-sub {
  font-size: 14px;
  color: var(--crm-text-muted);
}
/* Empty table state */
.view-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--crm-text-muted);
  font-size: 14px;
}
/* === SIDEBAR NAVIGATION + VIEWS END === */

/* === PLANTILLAS VIEW START === */
.tpl-variables {
  background: var(--crm-bg-soft);
  border: 1px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 2;
}
.tpl-variables code {
  background: rgba(37, 99, 235, 0.08);
  color: var(--crm-blue);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.tpl-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tpl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tpl-card-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--crm-text-main);
}
.tpl-key {
  font-size: 11px;
  background: var(--crm-bg-soft);
  color: var(--crm-text-muted);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
}
.tpl-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  border: 2px solid var(--crm-border-soft);
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s;
}
.tpl-textarea:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.tpl-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tpl-status {
  font-size: 13px;
  color: var(--crm-green);
  font-weight: 600;
}
/* === PLANTILLAS VIEW END === */

/* === CONFIGURACION VIEW START === */
.cfg-section {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border-soft);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.cfg-section h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--crm-text-main);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--crm-border-soft);
}
.cfg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.cfg-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crm-text-muted);
  margin-bottom: 6px;
}
.cfg-field input,
.cfg-field textarea {
  width: 100%;
  font-size: 14px;
  padding: 10px 14px;
  border: 2px solid var(--crm-border-soft);
  border-radius: 10px;
  transition: border-color 0.15s;
  font-family: inherit;
}
.cfg-field input:focus,
.cfg-field textarea:focus {
  outline: none;
  border-color: var(--crm-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.cfg-wide {
  grid-column: 1 / -1;
}
.cfg-variables {
  margin-top: 12px;
  font-size: 12px;
  color: var(--crm-text-muted);
  line-height: 2;
}
.cfg-variables code {
  background: rgba(37, 99, 235, 0.08);
  color: var(--crm-blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.cfg-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cfg-status {
  font-size: 14px;
  color: var(--crm-green);
  font-weight: 600;
}
/* === CONFIGURACION VIEW END === */

/* === REMAINING VIEWS STYLES === */
.view-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--crm-text-main);
  margin: 0 0 12px;
}
.view-hint {
  font-size: 13px;
  color: var(--crm-text-muted);
  margin: 0 0 16px;
}
.clickable-row {
  cursor: pointer;
  transition: background 0.12s;
}
.clickable-row:hover {
  background: rgba(37, 99, 235, 0.06) !important;
}
.clickable-row:active {
  background: rgba(37, 99, 235, 0.1) !important;
}
/* === REMAINING VIEWS STYLES END === */

/* === EMPTY STATES (modal de cliente) === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--crm-text-muted, #888888);
}
.empty-state-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--crm-text, #444444);
  margin-bottom: 4px;
}
.empty-state-sub {
  font-size: 12px;
  color: var(--crm-text-muted, #888888);
  max-width: 320px;
}

/* === SIDEBAR ACTION BUTTON (Leer mails) === */
.sidebar-action {
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: 8px;
}
.sidebar-action-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.sidebar-action-btn:hover {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.sidebar-action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

/* === WHATSAPP QR MODAL === */
.wsp-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.wsp-modal-content {
  background: white; border-radius: 12px; width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden;
}
.wsp-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eee;
}
.wsp-modal-header h3 { margin: 0; font-size: 16px; }
.wsp-modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: #888; padding: 0; line-height: 1;
}
.wsp-modal-close:hover { color: #333; }
.wsp-modal-body { padding: 20px; min-height: 200px; }
.sidebar-whatsapp-btn {
  background: linear-gradient(180deg, #25D366, #1DA851) !important;
}
.sidebar-whatsapp-btn:hover {
  background: linear-gradient(180deg, #2BE06F, #25D366) !important;
}

/* === CHAT OVERLAY: burbujas + input === */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chat-header h3 { margin: 0; }

.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 420px;
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  background: #f3f4f6;
  border-radius: 12px;
  border: 1px solid #e4e7ec;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chat-bubble-text {
  white-space: pre-wrap;
}
.chat-bubble-time {
  font-size: 10.5px;
  opacity: 0.65;
  margin-top: 4px;
  text-align: right;
}
.chat-bubble-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-bottom: 3px;
}

/* Cliente: izquierda, blanco */
.chat-bubble.client {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e4e7ec;
  border-bottom-left-radius: 4px;
  color: #1f2937;
}
.chat-bubble.client .chat-bubble-time { color: #9ca3af; }

/* Asesor: derecha, azul del sistema */
.chat-bubble.advisor {
  align-self: flex-end;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.advisor .chat-bubble-time { color: rgba(255,255,255,0.75); }

/* Bot: derecha, gris azulado claro */
.chat-bubble.bot {
  align-self: flex-end;
  background: #eef2ff;
  border: 1px solid #dbe4ff;
  color: #3730a3;
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot .chat-bubble-time { color: #818cf8; }

/* Sistema: centrado, neutro */
.chat-bubble.system {
  align-self: center;
  background: #f4f3ff;
  border: 1px solid #d9d6fe;
  color: #5b21b6;
  font-size: 12px;
  text-align: center;
}

/* Input bar */
.chat-input-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.chat-input-bar input[type="text"] {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid #d0d5dd;
  border-radius: 24px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input-bar input[type="text"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.chat-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-send-btn:hover {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* === WHATSAPP MODAL: scroll + marco === */
.wsp-modal-content {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.wsp-modal-body {
  max-height: 65vh;
  overflow-y: auto;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  margin: 0 4px;
  background: #f9fafb;
}
