.crm-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

[hidden] {
  display: none !important;
}

.crm-shell-hidden,
.crm-auth-hidden {
  display: none;
}

.crm-auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.crm-auth-card {
  width: min(480px, 100%);
  position: relative;
  overflow: hidden;
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(255, 134, 144, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.crm-auth-card h1 {
  color: #ffffff;
}

.crm-auth-card p {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.crm-login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.crm-hero,
.crm-panel,
.summary-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255, 134, 144, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.crm-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  align-items: end;
}

.crm-hero h1,
.crm-panel h2,
.detail-card h3,
.empty-state h2 {
  color: #ffffff;
}

.crm-hero p,
.empty-state p {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.crm-hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.ghost-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.crm-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.summary-card {
  padding: 24px;
  text-align: center;
}

.summary-card span {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  color: #ffffff;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.crm-workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.crm-panel {
  padding: 24px;
}

.crm-toolbar {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 16px;
}

.toolbar-field {
  display: grid;
  gap: 8px;
}

.toolbar-field span {
  color: #ffffff;
  font-weight: 600;
}

.toolbar-field textarea {
  min-height: 140px;
  resize: vertical;
}

.lead-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.lead-item {
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(6, 0, 47, 0.3);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
}

.lead-item.active {
  border-color: rgba(255, 134, 144, 0.8);
  box-shadow: 0 0 0 2px rgba(255, 134, 144, 0.2);
}

.lead-item-head,
.lead-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.lead-item-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lead-item-head strong {
  font-size: 1.05rem;
}

.lead-item p,
.lead-item small,
.detail-created,
.detail-data dd,
.detail-data dt,
.detail-feedback {
  color: rgba(255, 255, 255, 0.82);
}

.lead-item p {
  margin-top: 10px;
}

.lead-item-meta {
  margin-top: 12px;
  flex-wrap: wrap;
}

.lead-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.lead-badge.status-nuevo {
  background: rgba(73, 101, 211, 0.24);
}

.lead-badge.status-contactado {
  background: rgba(255, 134, 144, 0.24);
}

.lead-badge.status-documentacion {
  background: rgba(255, 206, 96, 0.24);
}

.lead-badge.status-cerrado {
  background: rgba(13, 179, 107, 0.24);
}

.lead-badge-internal {
  background: rgba(255, 215, 124, 0.2);
  color: #fff1c2;
}

.empty-state,
.detail-head {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-head h2 {
  margin-top: 12px;
}

.detail-head p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.74);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.detail-grid.single-column {
  grid-template-columns: 1fr;
}

.detail-card {
  min-width: 0;
  padding: 20px;
  border-radius: 22px;
  background: rgba(6, 0, 47, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-card h3 {
  margin-bottom: 14px;
}

.detail-data {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
  align-items: start;
}

.detail-data dt {
  font-weight: 700;
}

.detail-data dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-head > * {
  min-width: 0;
}

.detail-head h2,
.detail-head p,
.detail-created {
  overflow-wrap: anywhere;
}

.detail-feedback {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 600;
}

.hidden {
  display: none;
}

.empty-results {
  padding: 18px;
  border-radius: 18px;
  background: rgba(6, 0, 47, 0.24);
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
}

@media (max-width: 1024px) {
  .crm-summary,
  .crm-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .crm-shell {
    width: min(100% - 20px, 1280px);
    padding: 20px 0 40px;
  }

  .crm-hero,
  .crm-panel,
  .summary-card {
    padding: 20px;
  }

  .crm-hero,
  .detail-head,
  .lead-item-head,
  .lead-item-meta,
  .crm-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .detail-data {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
