@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Fraunces:opsz,wght@9..144,600&display=swap");

:root {
  --bg: #f4efe7;
  --bg-2: #fbf8f4;
  --ink: #1f2a28;
  --ink-soft: #53615d;
  --brand: #194b43;
  --brand-2: #b9503b;
  --line: #d9d1c7;
  --card: rgba(255, 255, 255, 0.9);
  --ok: #d9f4e3;
  --warn: #fce5d3;
  --risk: #f8dede;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff7ed 0%, transparent 35%),
    radial-gradient(circle at top right, #e6f4ef 0%, transparent 30%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

.hero {
  padding: 2rem 1.2rem 1rem;
  text-align: center;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-2);
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
}

h1 {
  margin: 0.4rem 0 0.6rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
  max-width: 760px;
  margin: 0 auto;
  color: var(--ink-soft);
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.layout {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 380px 1fr;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(38, 34, 26, 0.08);
  padding: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.muted {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.panel-note {
  margin: 0.5rem 0 0.8rem;
  max-width: 64ch;
}

.filters,
.stats,
.form-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.template-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.template-head {
  align-items: center;
}

.template-toolbar,
.template-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.template-grid {
  margin-top: 0.75rem;
}

.template-preview,
.template-hint {
  margin-top: 0.55rem;
}

.template-stats {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--brand);
}

.stats {
  margin: 0.8rem 0;
}

.stat {
  border-radius: 999px;
  padding: 0.25rem 0.72rem;
  font-size: 0.8rem;
  background: #f1ece5;
  color: var(--ink-soft);
}

.stat.ok {
  background: var(--ok);
  color: #0d5f42;
}

.stat.warn {
  background: var(--warn);
  color: #8a4b16;
}

.stat.risk {
  background: var(--risk);
  color: #a32626;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

.full-width {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0.62rem 0.7rem;
}

textarea {
  resize: vertical;
}

.btn,
.mini {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.6rem 0.95rem;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #267266 100%);
  color: #fff;
}

.btn-secondary {
  background: #efe8de;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

th,
td {
  padding: 0.72rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
  vertical-align: top;
  text-align: left;
}

th {
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-cell strong,
.line-cell strong {
  display: block;
  margin-bottom: 0.15rem;
}

.line-cell,
.contact-cell {
  min-width: 220px;
}

.value-stack {
  display: grid;
  gap: 0.2rem;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.52rem;
  font-size: 0.72rem;
  background: #f1ece5;
}

.pill.pipeline-caduca_este_mes,
.pill.expiry-este_mes {
  background: var(--risk);
  color: #8f1d1d;
}

.pill.pipeline-reactivacion,
.pill.queue-reactivation {
  background: var(--warn);
  color: #8a4b16;
}

.pill.pipeline-ganado,
.pill.contact-respondio,
.pill.contact-cliente_activo {
  background: var(--ok);
  color: #0d5f42;
}

.pill.pipeline-conversacion_abierta {
  background: #dde9fb;
  color: #214b92;
}

.pill.queue-contact_ready {
  background: #e7f0ff;
  color: #1e4f9e;
}

.action-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mini {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.32rem 0.55rem;
}

.mini.sms {
  border-color: #0d8f61;
  color: #0d8f61;
  font-weight: 700;
}

.mini.history {
  border-color: #3c5b94;
  color: #3c5b94;
}

.mini.edit {
  border-color: #8a4b16;
  color: #8a4b16;
}

.mini.whatsapp {
  border-color: #127c56;
  color: #127c56;
}

.history-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.sms-banner {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 92vw;
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 30px rgba(25, 75, 67, 0.18);
}

.sms-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.message-cell {
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
  color: var(--ink-soft);
}

.empty {
  color: var(--ink-soft);
}
