:root {
  --bg: #f6f8fb;
  --surface: rgba(255, 255, 255, 0.92);
  --line: #e6ebf2;
  --ink: #071735;
  --muted: #68738a;
  --teal: #3aa7a3;
  --teal-dark: #288d8b;
  --purple: #8f5cf6;
  --amber: #f2b33d;
  --blue: #3f7fe7;
  --green: #2fa765;
  --brand-2: #3f7fe7;
  --shadow: 0 18px 48px rgba(7, 23, 53, 0.09);
  /* Últimas fuentes: glifos emoji/color que Inter no cubre (evita cajas o “letras” rotas). */
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif,
    "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", emoji;
}
.nav-icon {
  font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", emoji;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at top left, #fff 0, #f7fbff 36%, var(--bg) 100%); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.app-shell { width: min(560px, 100%); min-height: var(--app-vh, 100vh); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px 98px; }
.app-topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; margin: -4px -4px 8px; padding: 4px; background: rgba(246, 248, 251, 0.78); backdrop-filter: blur(16px); }
.icon-button, .top-profile img, .detail-head a, .detail-head button { width: 48px; height: 48px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 12px 28px rgba(7, 23, 53, 0.08); }
.icon-button { display: grid; place-content: center; gap: 4px; }
.icon-button span { display: block; width: 18px; height: 2px; border-radius: 10px; background: var(--ink); }
.top-profile { display: flex; align-items: center; gap: 14px; }
.top-profile img { object-fit: cover; }
.bell { position: relative; color: var(--ink); font-size: 1.5rem; }
.bell b { position: absolute; top: -8px; right: -8px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: 0.66rem; }

.screen-head { margin: 16px 0 18px; }
.screen-head h1 { margin: 0 0 4px; color: var(--ink); font-size: clamp(2.25rem, 9vw, 3.2rem); line-height: 0.98; letter-spacing: 0; }
.screen-head.compact h1 { font-size: clamp(1.8rem, 7vw, 2.45rem); }
.screen-head p { margin: 0; color: var(--muted); line-height: 1.35; }

.search-pill { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 16px; padding: 0 16px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.search-pill input { min-width: 0; border: 0; outline: 0; color: var(--ink); }
.search-pill button { border: 0; background: transparent; color: var(--teal); font-size: 1.4rem; }

.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.metric-row article, .stats-card article, .card, .list-card, .stage-card, .info-grid article, .action-grid a { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.metric-row article { min-width: 0; padding: 12px 8px; text-align: center; }
.metric-row i, .stats-card i, .info-grid i { display: inline-grid; width: 38px; height: 38px; place-items: center; border-radius: 14px; color: #fff; font-style: normal; font-weight: 900; }
.metric-row span, .stats-card span, .info-grid span { display: block; margin-top: 7px; color: var(--muted); font-size: 0.74rem; font-weight: 800; }
.metric-row strong, .stats-card strong, .info-grid strong { display: block; margin-top: 4px; font-size: clamp(1rem, 4vw, 1.35rem); line-height: 1.05; }
.metric-row small, .stats-card small, .info-grid small { display: block; margin-top: 5px; color: var(--green); font-size: 0.68rem; font-weight: 800; }
.teal { background: var(--teal); } .purple { background: var(--purple); } .amber { background: var(--amber); } .mint { background: #65bfb8; } .blue { background: var(--blue); }

.card { padding: 16px; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 1.05rem; }
.section-title a, .section-title span { color: #1e63c5; font-size: 0.85rem; font-weight: 800; }
.funnel-card { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; align-items: center; }
.funnel-shape { display: grid; justify-items: center; gap: 3px; }
.funnel-shape span { display: grid; height: 38px; place-items: center; color: #fff; background: linear-gradient(90deg, #0a2747, var(--teal)); clip-path: polygon(8% 0, 92% 0, 80% 100%, 20% 100%); font-weight: 900; }
.stage-list { display: grid; gap: 8px; }
.stage-list p { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 0.82rem; }
.stage-list b { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.stage-list em { padding: 5px 8px; border-radius: 10px; background: #eef2f6; font-style: normal; font-weight: 900; }
.stage-list span { color: var(--muted); }
.chart-line { display: flex; align-items: end; gap: 4px; height: 112px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.chart-line i { flex: 1; min-width: 3px; border-radius: 9px 9px 0 0; background: linear-gradient(180deg, var(--teal), rgba(58,167,163,.14)); }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.76rem; margin-top: 8px; }

.task-list, .list-card { display: grid; gap: 0; }
.task-list article, .list-card article { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 72px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-list article:last-child, .list-card article:last-child { border-bottom: 0; }
.task-list i, .avatar-mini { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; background: #e6fbef; color: var(--green); font-style: normal; }
.task-list strong, .list-card strong { display: block; color: var(--ink); }
.task-list small, .list-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.78rem; }
.task-list span, .list-card span { padding: 7px 10px; border-radius: 12px; background: #e4faf6; color: var(--teal-dark); font-size: 0.75rem; font-weight: 900; }
.empty { margin: 0; padding: 18px; color: var(--muted); text-align: center; }

.stats-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.stats-card article { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; text-align: center; }
.stats-card article:last-child { border-right: 0; }
.tabs { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 16px; }
.tabs a { flex: 0 0 auto; min-width: 92px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-align: center; font-weight: 800; }
.tabs a.active { border-color: transparent; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; }
.list-card { padding: 0 16px; }
.list-card img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: #edf2f7; }
.list-card b { color: var(--muted); font-size: 1.6rem; }

.pipeline { display: grid; gap: 12px; }
.pipeline-bar { display: grid; grid-template-columns: repeat(6, 1fr); overflow: hidden; border-radius: 16px; background: #edf2f7; }
.pipeline-bar span { min-height: 38px; display: grid; place-items: center; color: #fff; background: linear-gradient(90deg, #0b3157, var(--teal)); font-size: 0.8rem; font-weight: 900; }
.pipeline-bar span:nth-child(n+4) { color: #486079; background: #dff0f2; }
.stage-card { padding: 12px; }
.stage-card header { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; margin-bottom: 8px; }
.stage-card header b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: #0b3157; color: #fff; }
.stage-card h2 { margin: 0; font-size: 1.05rem; }
.stage-card em { color: #49627d; font-style: normal; }
.stage-card a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 48px; border-top: 1px solid var(--line); }
.stage-card a i { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--purple); color: #fff; font-style: normal; font-size: 0.78rem; font-weight: 900; }
.stage-card a small { color: var(--muted); }
.stage-card p { margin: 8px 0 0; color: #1e63c5; text-align: center; font-size: 0.85rem; font-weight: 800; }

.detail-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; margin: 8px 0 18px; text-align: center; }
.detail-head h1 { margin: 0; font-size: 1.25rem; }
.detail-head a, .detail-head button { display: grid; place-items: center; color: var(--ink); font-size: 1.8rem; }
.contact-hero { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; margin-bottom: 16px; }
.contact-hero img { width: 96px; height: 96px; border-radius: 50%; }
.contact-hero h2 { margin: 0 0 5px; font-size: 1.45rem; }
.contact-hero span { padding: 7px 10px; border-radius: 10px; background: #dcf7e5; color: #218544; font-size: 0.78rem; font-weight: 900; }
.contact-hero p, .contact-lines { color: var(--muted); }
.contact-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; font-size: 0.86rem; }
.action-grid, .info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.action-grid a { display: grid; min-height: 84px; place-items: center; color: #1e63c5; font-size: 1.7rem; }
.action-grid span { color: var(--ink); font-size: 0.85rem; font-weight: 800; }
.info-grid { grid-template-columns: repeat(2, 1fr); }
.info-grid article { padding: 14px; }

.wa-shell { display: grid; grid-template-columns: 0.9fr 1.2fr; min-height: calc(var(--app-vh, 100vh) - 145px); overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.wa-list { min-height: 0; overflow: auto; border-right: 1px solid var(--line); }
.wa-accounts { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.wa-accounts a { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; background: #edf2f7; color: var(--muted); font-size: 0.78rem; font-weight: 900; }
.wa-accounts a.active { background: #dcf7e5; color: #218544; }
.wa-search { padding: 0 10px 10px; }
.wa-search input { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; }
.wa-list > a { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.wa-list > a.active { background: #e9fbf8; }
.wa-list i { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-style: normal; font-weight: 900; }
.wa-list small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-thread { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.wa-thread header { padding: 14px; border-bottom: 1px solid var(--line); }
.wa-thread header small { display: block; color: var(--muted); }
.wa-messages { display: flex; flex-direction: column; gap: 9px; min-height: 0; overflow: auto; padding: 14px; background: #efeae2; }
.wa-messages article { max-width: 78%; padding: 9px 10px; border-radius: 12px; background: #fff; }
.wa-messages article.out { align-self: flex-end; background: #d9fdd3; }
.wa-messages p { margin: 0 0 4px; }
.wa-messages small { display: block; color: #667781; text-align: right; font-size: 0.68rem; }
.wa-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; background: #f0f2f5; }
.wa-compose textarea { min-height: 44px; max-height: 110px; border: 0; border-radius: 22px; padding: 12px; resize: vertical; }
.wa-compose button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #25d366; color: #fff; font-weight: 900; }
.wa-empty { align-self: center; justify-self: center; color: var(--muted); text-align: center; }

.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-row img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; }
.app-form { display: grid; gap: 14px; }
.app-form label:not(.check-row) { display: grid; gap: 7px; color: var(--muted); font-weight: 900; }
.app-form input:not([type="checkbox"]):not([type="radio"]), .app-form textarea, .app-form select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 0 13px; background: #fff; color: var(--ink); }
.app-form input[type="checkbox"],
.app-form input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  flex-shrink: 0;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--line);
  accent-color: var(--teal);
  cursor: pointer;
  vertical-align: middle;
}
.primary-action, .secondary-action { display: inline-grid; min-height: 46px; place-items: center; border: 0; border-radius: 14px; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; cursor: pointer; font-weight: 900; }
.secondary-action { padding: 0 14px; border: 1px solid var(--teal); background: #fff; color: var(--teal-dark); }
.secondary-action.danger { border-color: #ef4444; color: #b42318; }
.full { width: 100%; }
.push-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.bottom-nav { position: fixed; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-width: 540px; margin: 0 auto; padding: 8px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.93); box-shadow: 0 18px 46px rgba(7,23,53,.16); backdrop-filter: blur(18px); }
.bottom-nav a { display: grid; min-height: 56px; place-items: center; color: var(--muted); font-size: 0.69rem; font-weight: 800; }
.bottom-nav span { display: block; font-size: 1.3rem; }
.bottom-nav a.active { color: var(--teal-dark); }
.floating-cta { position: fixed; right: max(18px, calc((100vw - 560px) / 2 + 18px)); bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px)); left: max(18px, calc((100vw - 560px) / 2 + 18px)); z-index: 22; display: grid; min-height: 54px; place-items: center; border-radius: 18px; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; box-shadow: var(--shadow); font-weight: 900; }
.fab { position: fixed; right: max(22px, calc((100vw - 560px) / 2 + 22px)); bottom: 102px; z-index: 24; display: grid; width: 62px; height: 62px; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; box-shadow: 0 18px 42px rgba(58,167,163,.34); font-size: 2.4rem; }
.drawer { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(340px, 86vw); padding: max(22px, env(safe-area-inset-top)) 18px 22px; background: #fff; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 28px 0 80px rgba(7,23,53,.18); }
.drawer-open .drawer { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 55; display: none; background: rgba(7,23,53,.34); }
.drawer-open .drawer-backdrop { display: block; }
.drawer-head { display: flex; gap: 12px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.drawer-head img { width: 52px; height: 52px; border-radius: 16px; }
.drawer-head strong, .drawer-head small { display: block; }
.drawer-head small { color: var(--muted); }
.drawer-nav { display: grid; gap: 8px; padding-top: 18px; }
.drawer-nav a { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 10px 12px; border-radius: 14px; font-weight: 900; }
.drawer-nav a.active { background: #e9fbf8; color: var(--teal-dark); }
.drawer-nav span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: #edf2f7; }

.notice { width: min(560px, 100%); margin: 8px auto 14px; padding: 12px 14px; border-radius: 14px; background: #eef6ff; color: #1e63c5; font-weight: 800; }
.notice-error { background: #fee2e2; color: #b42318; }
.notice-success { background: #dcf7e5; color: #218544; }
.login-page { display: grid; min-height: var(--app-vh, 100vh); place-items: center; padding: 22px; background: linear-gradient(145deg, #f6f8fb, #fff); }
.login-card { width: min(430px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.login-card img { width: 74px; height: 74px; border-radius: 20px; }
.login-card h1 { margin: 14px 0 8px; font-size: 2.1rem; line-height: 1; }
.login-card p { color: var(--muted); line-height: 1.45; }
.eyebrow { margin: 16px 0 0; color: var(--teal-dark); font-size: .78rem; font-weight: 1000; text-transform: uppercase; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  padding: 8px 0;
  min-height: 44px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.35;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.check-row .check-row-text {
  flex: 1;
  min-width: 0;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ui-icon { display: block; flex-shrink: 0; }
.ui-icon-sm { width: 16px; height: 16px; }
.ui-icon-muted { color: var(--muted); }
.ui-icon-teal { color: var(--teal-dark); }
.ui-icon-inline { display: inline-block; vertical-align: -0.2em; margin-right: 4px; }

.crm-hero { margin: 8px 0 18px; }
.crm-hero--compact { margin-bottom: 12px; }
.crm-hero-title { margin: 0 0 10px; font-size: clamp(2.1rem, 8vw, 2.85rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
.crm-greeting { margin: 0 0 6px; font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.crm-wave { margin-left: 2px; }
.crm-subtitle { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }

.search-pill--crm { box-shadow: 0 10px 34px rgba(7, 23, 53, 0.07); border-radius: 999px; }
.search-pill-icon { display: grid; place-items: center; color: var(--muted); }
.search-pill-filter { display: grid; place-items: center; padding: 4px; border-radius: 12px; cursor: pointer; }

.metric-strip-scroll { margin: 0 -6px 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.metric-strip { display: flex; gap: 11px; padding: 2px 6px 8px; min-width: min-content; }
.kpi-card {
  flex: 0 0 auto;
  width: 132px;
  padding: 14px 12px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 14px 34px rgba(7, 23, 53, 0.06);
  text-align: center;
}
a.kpi-card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.kpi-card--link:hover {
  box-shadow: 0 16px 38px rgba(7, 23, 53, 0.1);
}
a.kpi-card--link:active {
  transform: scale(0.98);
}
a.kpi-card--link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.home-funnel-title-link {
  color: inherit;
  text-decoration: none;
}
.home-funnel-title-link:hover {
  color: var(--teal-dark);
}
.home-funnel-title-link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}
.kpi-card--flat { width: auto; flex: 1; min-width: 0; box-shadow: none; border: 0; border-radius: 0; padding: 10px 8px; background: transparent; }
.kpi-dot { display: grid !important; width: 36px !important; height: 36px !important; margin: 0 auto 8px; border-radius: 50%; place-items: center; font-size: 0.65rem; color: #fff !important; font-style: normal !important; line-height: 1; }
.kpi-label { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 800; margin-bottom: 6px; }
.kpi-value { display: block; font-size: 1.22rem; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); }
.kpi-caption { display: block; margin-top: 4px; font-size: 0.66rem; font-weight: 700; color: #8b96aa; }
.trend { display: block; margin-top: 5px; font-size: 0.74rem; font-weight: 900; }
.trend-up { color: var(--green); }
.trend-down { color: #dc2626; }
.trend-neutral { color: var(--muted); font-weight: 800; }
.trend-muted { color: var(--muted); font-size: 0.72rem !important; font-weight: 700 !important; }

.card--elevated { box-shadow: 0 16px 42px rgba(7, 23, 53, 0.08); border-radius: 22px; }
.section-title--crm { margin-bottom: 16px; align-items: flex-start; }
.section-title--crm h2 { font-size: 1.12rem; font-weight: 900; }
.section-title--crm a { color: #2563eb; font-weight: 800; }
.pill-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: default;
}
.pill-select--ghost { border-color: transparent; background: #edf2f7; color: var(--muted); }

.funnel-card--mock { align-items: stretch; }
.funnel-shape--layers { gap: 5px; }
.funnel-shape--layers span {
  height: 44px;
  font-size: 0.92rem;
  clip-path: polygon(6% 0, 94% 0, 82% 100%, 18% 100%);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.12);
}
.funnel-tier-1 { background: linear-gradient(90deg, #0a2747, #134068) !important; }
.funnel-tier-2 { background: linear-gradient(90deg, #134068, #1e6f86) !important; }
.funnel-tier-3 { background: linear-gradient(90deg, #1e6f86, var(--teal)) !important; }
.funnel-tier-4 { background: linear-gradient(90deg, var(--teal), #7ecec8) !important; color: #06302e !important; }

.stage-list--crm { gap: 11px; }
.stage-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.stage-name { font-weight: 800; color: var(--ink); }
.stage-pct { padding: 5px 10px; border-radius: 10px; background: #eef2f6; font-weight: 900; font-size: 0.78rem; }
.stage-count { color: var(--muted); font-weight: 800; text-align: right; }

.chart-legend { display: flex; gap: 18px; margin-bottom: 12px; font-size: 0.78rem; font-weight: 800; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-dot { display: inline-block; width: 22px; height: 3px; border-radius: 99px; vertical-align: middle; }
.chart-dot--solid { background: var(--teal); }
.chart-dot--dash { border-top: 3px dashed #b8c2d4; height: 0; width: 22px; background: transparent; }
.chart-area { padding-top: 6px; }
.chart-bars { display: flex; align-items: flex-end; gap: 5px; height: 128px; padding: 0 2px 10px; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; min-width: 4px; height: 100%; }
.chart-prev { width: 42%; max-width: 7px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #cbd5e1, rgba(203, 213, 225, 0.15)); align-self: flex-end; }
.chart-curr { width: 42%; max-width: 7px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--teal), rgba(58, 167, 163, 0.18)); align-self: flex-end; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.72rem; font-weight: 800; margin-top: 8px; }
.chart-axis--spread { padding: 0 4px; }
.chart-axis-labels { display: flex; justify-content: space-between; gap: 6px; margin-top: 10px; overflow-x: auto; font-size: 0.68rem; font-weight: 700; color: #8b96aa; }
.chart-empty { grid-column: 1 / -1; align-self: center; }

.task-list--crm { gap: 0; }
.task-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; font-style: normal; font-size: 1.25rem; }
.task-icon-call { background: #e8faf0; }
.task-icon-meet { background: #ede9fe; }
.task-icon-mail { background: #e0edff; }
.task-icon-note { background: #e9fbf8; color: var(--teal-dark); }
.task-body strong { display: block; font-weight: 900; }
.task-body small { color: var(--muted); font-size: 0.8rem; }
.prio { padding: 8px 11px; border-radius: 999px; font-size: 0.72rem; font-weight: 900; }
.prio-high { background: #dcf7e5; color: #166534; }
.prio-med { background: #fff4e0; color: #b45309; }
.prio-low { background: #e0edff; color: #1e40af; }

.stats-card--kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 8px 4px; align-items: stretch; }
.stats-card--kpi .kpi-card--flat { border-right: 1px solid var(--line); }
.stats-card--kpi .kpi-card--flat:last-child { border-right: 0; }

.segment-tabs { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.segment-tabs a {
  flex: 0 0 auto;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
}
.segment-tabs a.active { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; border-color: transparent; }

.list-card--contacts { padding: 8px 14px 14px; border-radius: 22px; overflow: hidden; }
.contact-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease;
}
.contact-row:last-child { border-bottom: 0; }
.contact-row:active { background: #f4faf9; }
.contact-avatar-wrap { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.contact-avatar-wrap img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #edf2f7; }
.contact-presence { position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; }
.presence-online { background: #22c55e; }
.presence-away { background: #eab308; }
.contact-main strong { display: block; font-size: 1.02rem; font-weight: 900; }
.contact-company { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.contact-meta { display: block; margin-top: 6px; font-size: 0.74rem; color: #8b96aa; }
.contact-next { display: flex; align-items: center; gap: 4px; margin-top: 7px; font-size: 0.74rem; font-weight: 800; color: #2563eb; }
.contact-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.badge { padding: 7px 11px; border-radius: 999px; font-size: 0.72rem; font-weight: 900; white-space: nowrap; }
.badge-cliente { background: #dcf7e5; color: #166534; }
.badge-lead { background: #dbeafe; color: #1d4ed8; }
.badge-vip { background: #ede9fe; color: #6d28d9; }
.contact-chevron { font-size: 1.45rem; color: #c5cedd; font-weight: 300; line-height: 1; }

.fab--contacts { bottom: max(96px, calc(env(safe-area-inset-bottom) + 96px)); box-shadow: 0 16px 40px rgba(58, 167, 163, 0.38); }

.crm-topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; margin: 4px 0 10px; }
.crm-back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #fff; box-shadow: 0 10px 26px rgba(7, 23, 53, 0.08); font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.crm-topbar-center { min-width: 0; }
.crm-topbar-title { margin: 2px 0 4px; font-size: 1.38rem; font-weight: 900; letter-spacing: -0.02em; }
.crm-topbar-embudo-activo { margin: 0 0 8px; font-size: 0.95rem; line-height: 1.35; color: var(--ink); }
.crm-topbar-embudo-activo strong { font-weight: 800; }
.crm-topbar-embudo-scope { font-weight: 600; color: var(--muted); margin-left: 2px; }
.crm-table-form { margin: 0; }
.crm-select { width: 100%; max-width: 280px; min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 700; color: var(--ink); }
.crm-topbar-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 12px;
  background: #edf2f7;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}
.icon-chip { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 1px solid var(--line); color: var(--teal-dark); }
.crm-lede { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }

.crm-funnel-board { margin-bottom: 14px; }
.crm-funnel-acc {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(7, 23, 53, 0.05);
}
.crm-funnel-acc-sum {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.crm-funnel-acc-sum::-webkit-details-marker { display: none; }
.crm-funnel-acc-sum::marker { content: ''; }
.crm-funnel-acc-title { font-size: 1rem; color: var(--ink); }
.crm-funnel-acc-stats { font-size: 0.8rem; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crm-funnel-acc-dot { opacity: 0.45; }
.crm-funnel-acc-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.crm-funnel-acc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 12px; }
.crm-funnel-open { min-height: 44px; padding: 0 18px; border-radius: 14px; text-decoration: none; font-size: 0.88rem; }
.crm-funnel-prev-label { margin: 0 0 8px; font-size: 0.72rem; font-weight: 950; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.crm-funnel-prev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.crm-funnel-prev-list li { border-top: 1px solid var(--line); }
.crm-funnel-prev-list li:first-child { border-top: 0; }
.crm-funnel-prev-list a {
  display: block;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}
.crm-funnel-prev-list strong { display: block; font-size: 0.92rem; }
.crm-funnel-prev-list small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.crm-funnel-prev-empty { margin: 8px 0 0; font-size: 0.86rem; color: var(--muted); }

.crm-recent-leads { margin-bottom: 14px; }
.crm-recent-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) {
  .crm-recent-cols { grid-template-columns: 1fr; }
}
.crm-recent-h { margin: 0 0 10px; font-size: 0.82rem; font-weight: 950; color: var(--teal-dark); text-transform: uppercase; letter-spacing: 0.03em; }
.crm-recent-ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.crm-recent-ul a { display: block; padding: 10px 12px; border-radius: 12px; background: #f6f8fb; border: 1px solid var(--line); color: inherit; text-decoration: none; font-weight: 800; font-size: 0.88rem; }
.crm-recent-ul small { display: block; margin-top: 4px; font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.crm-recent-empty { margin: 0; font-size: 0.84rem; color: var(--muted); }

.crm-push-funnels { display: grid; gap: 10px; }
.crm-push-funnel-acc {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.crm-push-funnel-sum {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
}
.crm-push-funnel-sum::-webkit-details-marker { display: none; }
.crm-push-funnel-sum::marker { content: ''; }
.crm-push-funnel-name { font-size: 0.98rem; color: var(--ink); }
.crm-push-funnel-meta { font-size: 0.78rem; font-weight: 800; color: var(--muted); }
.crm-push-funnel-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }

.pipeline-chevron { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 3px; border-radius: 18px; overflow: hidden; background: #eef2f7; }
.pipeline-chevron-seg {
  min-height: 42px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #0b3157, #3aa7a3);
}
.pipeline-chevron-seg:nth-child(n+5) { color: #334155; background: linear-gradient(180deg, #e2e8f0, #f1f5f9); }

.pipeline-acc { display: grid; gap: 8px; margin-bottom: 110px; padding-left: 2px; }
.stage-acc { border: 1px solid var(--line); border-radius: 18px; background: #fff; overflow: hidden; box-shadow: 0 10px 28px rgba(7, 23, 53, 0.05); position: relative; }
.stage-acc-summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 14px 18px;
  cursor: pointer;
  font-weight: 800;
}
.stage-acc-summary::-webkit-details-marker { display: none; }
.stage-acc-summary::marker { content: ''; }
.stage-acc-num {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  z-index: 1;
}
.stage-acc-text span { display: block; margin-top: 3px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.stage-acc-chev { font-size: 1.1rem; color: var(--muted); transition: transform 0.2s ease; }
.stage-acc[open] .stage-acc-chev { transform: rotate(-180deg); }
.stage-acc-body { padding: 4px 14px 14px 18px; border-top: 1px solid var(--line); background: #fafbfd; }
.deal-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.deal-row:last-child { margin-bottom: 0; }
.deal-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: #fff; font-size: 0.76rem; font-weight: 900; }
.deal-main strong { font-size: 0.92rem; }
.deal-main small { display: block; margin-top: 3px; font-size: 0.74rem; color: var(--muted); }
.deal-value { font-weight: 900; font-size: 0.82rem; color: var(--ink); }
.deal-pill { padding: 6px 10px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 0.74rem; font-weight: 900; }
.deal-more { margin: 10px 0 0; text-align: center; color: #2563eb; font-weight: 800; font-size: 0.84rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.deal-empty { margin: 8px 0; color: var(--muted); font-size: 0.86rem; }

.cta-row { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 100px; padding: 0 4px; }
.floating-cta--inline { position: relative; inset: auto; flex: 1; right: auto; left: auto; max-width: 400px; border-radius: 16px; min-height: 52px; }
.cta-more {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(7, 23, 53, 0.08);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--muted);
  text-decoration: none;
}

.detail-head--crm { margin-top: 4px; }
.contact-hero--detail { grid-template-columns: 88px 1fr; align-items: flex-start; margin-bottom: 18px; }
.contact-hero--detail img { width: 88px; height: 88px; border-radius: 50%; }
.contact-hero-body { min-width: 0; }
.contact-hero-body h2 { margin: 0 0 8px; font-size: 1.42rem; font-weight: 900; line-height: 1.15; }
.hero-role { margin: 6px 0 4px; color: var(--muted); font-weight: 700; font-size: 0.92rem; }
.hero-loc { margin: 0; font-size: 0.84rem; color: var(--muted); }

.contact-quick-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.cql-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 86px;
  padding: 12px 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(7, 23, 53, 0.06);
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink);
  text-decoration: none;
}
.cql-ico { font-size: 1.35rem; line-height: 1; }
.cql-call .cql-ico { color: #16a34a; }
.cql-wa .cql-ico { color: #25d366; }
.cql-mail .cql-ico { color: #2563eb; }
.cql-cal .cql-ico { color: #8f5cf6; }

.info-grid--detail article { padding: 16px 14px; border-radius: 18px; }
.tile-icon {
  display: inline-grid !important;
  width: 34px !important;
  height: 34px !important;
  place-items: center;
  border-radius: 11px;
  font-style: normal !important;
  font-weight: 900 !important;
  margin-bottom: 8px;
  color: #fff !important;
}
.tile-money { background: var(--green); }
.tile-clock { background: var(--blue); }
.tile-cal { background: var(--purple); }
.tile-src { background: var(--amber); color: #333 !important; }

.activity-feed { display: grid; gap: 0; }
.activity-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.activity-row:last-child { border-bottom: 0; }
.activity-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.activity-dot--note { background: #3f7fe7; }
.activity-row strong { display: block; font-weight: 900; }
.activity-row small { color: var(--muted); font-size: 0.78rem; }
.activity-snippet { margin: 6px 0 0; font-size: 0.82rem; color: #4b5873; line-height: 1.35; }

.opp-feed { padding-bottom: 8px; }
.opp-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; }
.opp-crown { font-size: 1.35rem; }
.opp-main strong { font-weight: 900; }
.opp-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.82rem; }
.opp-pill { padding: 8px 12px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-weight: 900; font-size: 0.78rem; }

@media (max-width: 720px) {
  .metric-row { grid-template-columns: repeat(4, minmax(78px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
  .metric-row article { min-width: 106px; }
  .wa-shell { display: block; min-height: calc(var(--app-vh, 100vh) - 128px); }
  .wa-list { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .wa-thread { min-height: 52vh; }
  .contact-lines, .action-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel-card--mock { grid-template-columns: 1fr; gap: 18px; }
  .crm-topbar { grid-template-columns: auto 1fr; grid-template-rows: auto auto; }
  .crm-topbar-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }

  .wa-message-thread {
    min-height: 0;
    padding: 12px 10px;
  }

  .wa-bubble {
    max-width: 86%;
  }

  .wa-account-settings {
    max-height: 160px;
    overflow: auto;
  }

  .wa-sidebar-head,
  .wa-chat-header {
    min-height: 62px;
    padding: 10px 12px;
  }

  .wa-chat-list a {
    min-height: 68px;
    padding: 10px 12px;
  }

  .wa-avatar {
    width: 42px;
    height: 42px;
  }

  .wa-compose {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

body.whatsapp-screen {
  overflow: hidden;
  overflow-x: hidden;
  max-width: 100%;
}

body.whatsapp-screen .bottom-nav {
  display: none;
}

body.whatsapp-screen .app-shell {
  display: flex;
  flex-direction: column;
  height: calc(var(--app-vh, 100dvh) - env(safe-area-inset-top));
  min-height: calc(var(--app-vh, 100dvh) - env(safe-area-inset-top));
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 0;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  max-width: 100%;
  overflow: hidden;
  overflow-x: hidden;
  box-sizing: border-box;
}

body.whatsapp-screen .app-topbar {
  position: relative;
  top: auto;
  margin: 0 0 6px;
}

body.whatsapp-screen .notice {
  margin: 8px 0;
}

body.whatsapp-screen .wa-app-shell {
  flex: 1 1 auto;
  min-height: 0;
}

/* Cuando se abre el teclado, evita min-height grandes que “tapan” el chat. */
body.wa-keyboard-open .wa-app-shell {
  min-height: 0;
  max-height: none;
  height: var(--wa-shell-height, calc(var(--app-vh, 100dvh) - 88px));
}

body.wa-keyboard-open .wa-app-shell .wa-sidebar,
body.wa-keyboard-open .wa-app-shell .wa-chat-panel {
  height: var(--wa-shell-height, calc(var(--app-vh, 100dvh) - 88px));
}

body.wa-keyboard-open .wa-window-closed,
body.wa-keyboard-open .wa-template-box,
body.wa-keyboard-open .wa-thread-search {
  display: none !important;
}

.muted-caption {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.activity-form-context {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
}

.activity-row--static {
  cursor: default;
}

.activity-row--static .contact-chevron {
  display: none;
}

.crm-push-list {
  display: grid;
  gap: 10px;
}

.crm-push-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.crm-push-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.crm-push-toggle {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #e5e7eb;
  color: #475569;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.crm-push-toggle.is-on {
  background: #d9fdd3;
  color: #087346;
}

/* Vista tipo app de WhatsApp: lista a pantalla completa o chat a pantalla completa (no dividido en escritorio). */
.wa-app-shell {
  display: block;
  height: var(--wa-shell-height, calc(var(--app-vh, 100dvh) - 88px));
  min-height: min(640px, calc(var(--app-vh, 100vh) - 100px));
  max-height: calc(var(--app-vh, 100dvh) - 76px);
  overflow: hidden;
  overflow-x: hidden;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  background: #ece5dd;
  box-shadow: none;
}

.wa-app-shell .wa-sidebar,
.wa-app-shell .wa-chat-panel {
  height: var(--wa-shell-height, calc(var(--app-vh, 100dvh) - 88px));
  min-height: 0;
}

.wa-app-shell.is-chat-open .wa-sidebar {
  display: none;
}

.wa-app-shell.is-list-open .wa-chat-panel {
  display: none;
}

.wa-sidebar,
.wa-chat-panel {
  min-height: 0;
}

.wa-sidebar {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  border-right: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.wa-sidebar-head,
.wa-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #075e54, #064942);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  color: #e9edef;
}

.wa-sidebar-head {
  justify-content: space-between;
}

.wa-sidebar-head h2 {
  margin: 0;
  font-size: 1.28rem;
  color: #fff;
  font-weight: 900;
}
.wa-sidebar-head .eyebrow {
  color: rgba(233, 237, 239, 0.78);
}

.wa-refresh,
.wa-chat-header > a {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  text-decoration: none;
  transition: background 0.15s ease;
}
.wa-refresh:hover,
.wa-chat-header > a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.wa-account-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wa-account-row a {
  flex: 0 0 auto;
  max-width: 170px;
  padding: 8px 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-account-row a.active {
  background: #e7f7ee;
  color: #087346;
}

.wa-account-settings {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wa-push-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.wa-push-toggle strong,
.wa-push-toggle small {
  display: block;
}

.wa-push-toggle small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.wa-push-toggle button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #e5e7eb;
  color: #475569;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 900;
}

.wa-preferred-form button {
  min-height: 30px;
  padding: 0 10px;
  margin: 0 12px 8px;
  border: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
}

.wa-preferred-form button.is-on {
  background: #dbeafe;
  color: var(--brand-2);
}

.wa-push-toggle button.is-on {
  background: #d9fdd3;
  color: #087346;
}

.wa-push-toggle button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.wa-config-warning {
  margin: 10px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.82rem;
  font-weight: 800;
}

.wa-search,
.wa-thread-search {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.wa-search span,
.wa-thread-search span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wa-search input,
.wa-thread-search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.wa-thread-search {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  background: #f0f2f5;
}

.wa-thread-search span,
.wa-thread-search input {
  grid-column: 1;
}

.wa-thread-search small {
  grid-row: 1 / 3;
  grid-column: 2;
  min-width: 28px;
  color: #087346;
  font-size: 0.76rem;
  font-weight: 950;
  text-align: right;
}

.wa-chat-list {
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.wa-chat-list .empty-state {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.wa-chat-list .empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.wa-chat-list a {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.wa-chat-list a.active,
.wa-chat-list a:hover {
  background: #f0f2f5;
}

.wa-avatar {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9fdd3, #c8e6d2);
  color: #075e54;
  font-weight: 950;
}

.wa-chat-list strong,
.wa-chat-list small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-chat-list small {
  margin-top: 4px;
  color: var(--muted);
}

.wa-chat-list time {
  align-self: start;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.wa-chat-list b {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-size: 0.72rem;
}

.wa-chat-panel {
  /* Columna flex, NO grid. La plantilla anterior (auto auto 1fr auto) asignaba
     el hueco grande a la TERCERA fila visible, fuera quien fuera: según qué
     elementos opcionales se pintaran (aviso Baileys, buscador, mensajes
     rápidos, plantillas…), el 1fr le caía al buscador o a la caja de plantillas
     y el hilo de mensajes quedaba aplastado. Con flex, el hilo es quien crece
     SIEMPRE (flex en .wa-message-thread) y el resto mide lo suyo. */
  display: flex;
  flex-direction: column;
  background: #efeae2;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  box-sizing: border-box;
}

.wa-chat-panel > .wa-message-thread {
  flex: 1 1 auto;
}

.wa-chat-panel > .wa-no-chat {
  margin: auto;
}

.wa-chat-header {
  background: linear-gradient(180deg, #075e54, #064942);
}

.wa-chat-header > a {
  display: inline-grid;
}

.wa-chat-header div {
  min-width: 0;
}

.wa-chat-header strong,
.wa-chat-header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-chat-header strong {
  color: #fff;
}

.wa-chat-header small {
  margin-top: 2px;
  color: rgba(233, 237, 239, 0.82);
}

.wa-message-thread {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  overflow-anchor: none;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.34) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.28) 0 2px, transparent 3px),
    #efeae2;
}

.wa-message-thread .empty-state {
  align-self: center;
  margin: auto;
  max-width: 300px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  text-align: center;
}

.wa-bubble {
  max-width: min(78%, 560px);
  padding: 8px 10px 6px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.wa-bubble.inbound {
  align-self: flex-start;
  background: #fff;
}

.wa-bubble.outbound {
  align-self: flex-end;
  background: #d9fdd3;
}

.wa-bubble p {
  margin: 0 0 4px;
  line-height: 1.35;
}

.wa-bubble small {
  display: block;
  color: #667781;
  font-size: 0.68rem;
  text-align: right;
}

.wa-bubble.is-search-hidden {
  display: none;
}

.wa-bubble.is-search-match {
  outline: 2px solid rgba(37, 211, 102, 0.58);
  outline-offset: 2px;
}

.wa-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #f0f2f5;
}

.wa-attach-button,
.wa-template-toggle,
.wa-record-button,
.wa-compose .wa-send-btn {
  display: inline-grid;
  width: 42px;
  height: 46px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #54656f;
  cursor: pointer;
  font-size: 1.05rem;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.wa-template-toggle {
  color: #0f172a;
  font-weight: 900;
}

.wa-record-button.is-recording {
  background: #fee2e2;
  color: #b91c1c;
}

.wa-compose textarea {
  flex: 1 1 140px;
  width: auto;
  min-width: 0;
  min-height: 46px;
  max-height: 116px;
  padding: 12px 14px;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: none;
  outline: none;
  overflow-y: hidden;
}

.wa-file-preview {
  flex: 1 0 100%;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  color: #54656f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 800;
}

.wa-file-preview[hidden] {
  display: none !important;
}

.wa-attach-button {
  position: relative;
}

.wa-compose.wa-compose--simple {
  grid-template-columns: minmax(0, 1fr) 46px;
}

.wa-compose.wa-compose--rich {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  z-index: 2;
}

.wa-compose-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 46px;
  gap: 6px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.wa-recording-hint {
  margin: 0 0 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #7f1d1d;
  background: #fef2f2;
  border-radius: 12px;
  border: 1px solid rgba(185, 28, 28, 0.12);
}

.wa-recording-hint[hidden] {
  display: none !important;
}

.wa-window-closed {
  margin: 8px 10px 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(254, 242, 242, 0.95);
  border: 1px solid rgba(185, 28, 28, 0.12);
  color: #7f1d1d;
}

.wa-window-closed strong {
  display: block;
  margin-bottom: 2px;
}

.wa-window-closed p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
}

.wa-template-box {
  margin: 8px 10px 6px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.wa-template-box summary {
  list-style: none;
  cursor: pointer;
}

.wa-template-box summary::-webkit-details-marker {
  display: none;
}

.wa-template-summary strong {
  display: block;
}

.wa-template-summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.wa-template-box[hidden] {
  display: none !important;
}

.wa-template-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.wa-template-controls select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0 12px;
  background: #fff;
}

.wa-template-ai,
.wa-template-send {
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  min-height: 44px;
  font-weight: 900;
  cursor: pointer;
}

.wa-template-ai {
  background: #e2e8f0;
  color: #0f172a;
}

.wa-template-send {
  width: 100%;
  margin-top: 10px;
  background: #25d366;
  color: #fff;
}

.wa-template-vars {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.wa-template-var {
  display: grid;
  gap: 6px;
}

.wa-template-var label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.wa-template-var input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0 12px;
  background: #fff;
}

.wa-more-wrap {
  position: relative;
  align-self: flex-end;
  flex-shrink: 0;
}

.wa-more-btn {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, background 0.15s ease;
  color: #334155;
}

.wa-more-btn:active {
  transform: scale(0.94);
}

.wa-more-btn.is-recording {
  background: #fecaca;
  color: #991b1b;
  animation: wa-rec-pulse 1s ease-in-out infinite;
}

.wa-more-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wa-more-icon {
  position: relative;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.wa-more-icon::before,
.wa-more-icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.wa-more-icon::before {
  transform: translateY(-7px);
}

.wa-more-icon::after {
  transform: translateY(7px);
}

.wa-more-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 32;
  min-width: min(268px, calc(100vw - 28px));
  padding: 6px 0;
  margin: 0;
  list-style: none;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.14);
  box-sizing: border-box;
}

.wa-more-menu[hidden] {
  display: none !important;
}

.wa-more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  margin: 0;
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.wa-more-item:hover,
.wa-more-item:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.wa-more-item:active {
  background: #e2e8f0;
}

.wa-more-item + .wa-more-item {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.wa-more-glyph {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.wa-more-label {
  flex: 1;
}

.wa-compose.wa-compose--rich .wa-more-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #334155;
  font-weight: 600;
}

.wa-compose.wa-compose--rich .wa-more-menu .wa-more-item {
  width: 100%;
  height: auto;
  min-height: 48px;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}

@keyframes wa-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.wa-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wa-compose--rich .wa-emoji-panel:not([hidden]) {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 4px);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  padding: 10px 8px;
  max-height: min(200px, 38vh);
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.12);
  box-sizing: border-box;
}

.wa-compose--rich .wa-emoji-panel[hidden] {
  display: none !important;
}

.wa-emoji-panel button {
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1.2;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
}

.wa-emoji-panel button:hover,
.wa-emoji-panel button:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.wa-compose--rich textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 14px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.45;
  resize: none;
  outline: none;
  box-sizing: border-box;
  overflow-y: hidden;
}

.wa-app-shell.is-writing .wa-thread-search,
body.wa-keyboard-open .wa-thread-search {
  display: none;
}

.wa-app-shell.is-writing .wa-template-box {
  display: none;
}

body.wa-keyboard-open .wa-compose.wa-compose--rich {
  padding-top: 6px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.wa-compose .wa-send-btn {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 950;
  flex-shrink: 0;
}

.wa-compose .wa-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 400px) {
  .wa-more-btn {
    width: 36px;
    height: 36px;
  }

  .wa-compose .wa-send-btn {
    width: 42px;
    height: 42px;
  }

  .wa-compose--rich textarea {
    min-height: 38px;
    max-height: 110px;
  }
}

.wa-compose.wa-compose--simple .wa-send-btn {
  grid-column: 2;
}

.wa-no-chat {
  align-self: center;
  justify-self: center;
  max-width: 320px;
  padding: 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  text-align: center;
}

.wa-no-chat strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.wa-line-settings {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.wa-line-settings summary {
  padding: 10px 12px;
  color: #087346;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.wa-media-image,
.wa-media-video {
  display: block;
  width: min(280px, 100%);
  max-height: 320px;
  margin-bottom: 6px;
  border-radius: 8px;
  object-fit: contain;
  background: #111827;
  /* ⚠️ La caja se reserva ANTES de que cargue la foto. Sin esto, la imagen mide
     0 de alto hasta que llega y entonces empuja de golpe todo lo que tiene
     debajo: si estabas leyendo, el texto se te iba de la pantalla. Y como el
     alto real no se conoce hasta descargarla, la única forma de reservarlo es
     fijar la proporción. `contain` mantiene la foto entera dentro (nada de
     recortes), con el fondo oscuro haciendo de marco en las verticales. */
  aspect-ratio: 4 / 3;
}

.wa-media-audio {
  width: min(280px, 100%);
  margin-bottom: 6px;
}

.wa-media-doc {
  display: block;
  margin-bottom: 6px;
  color: #075e54;
  font-weight: 900;
}

.wa-filters {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  background: #f4fbfb;
}

.wa-filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.wa-filters select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.84rem;
  background: #fff;
}

.wa-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wa-filter-actions button,
.wa-filter-actions a {
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 10px;
  padding: 8px 12px;
}

.wa-filter-actions button {
  border: 0;
  background: var(--brand);
  color: #fff;
}

.wa-filter-actions a {
  color: var(--brand);
  text-decoration: none;
}

.wa-notes-banner {
  margin: 8px 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  font-size: 0.8rem;
}

.wa-notes-banner ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.wa-forward-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(58, 167, 163, 0.15);
  font-size: 0.82rem;
}

.wa-forward-bar button {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 800;
  background: #fff;
}

.wa-forward-bar button.is-primary {
  background: var(--brand);
  color: #fff;
}

.wa-forward-mode-btn {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
}

.wa-baileys-hint {
  margin: 6px 12px 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.wa-bubble {
  position: relative;
}

.wa-msg-action {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.wa-forward-pick {
  position: absolute;
  top: 6px;
  left: -28px;
  display: flex;
  align-items: center;
}

.wa-forward-mode .wa-bubble.outbound,
.wa-forward-mode .wa-bubble.inbound {
  margin-left: 28px;
}

.wa-forward-mode .wa-msg-action {
  display: none;
}

.wa-quick-box {
  margin: 0 12px 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.wa-quick-box > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.wa-quick-box > summary::-webkit-details-marker {
  display: none;
}

.wa-quick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
}

.wa-quick-empty {
  margin: 4px 8px 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.wa-quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  background: #f4fbfb;
  font: inherit;
  cursor: pointer;
}

.wa-quick-thumb-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: #e5e7eb;
}

.wa-quick-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-quick-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wa-quick-sc {
  font-weight: 900;
  font-size: 0.82rem;
  color: #3aa7a3;
}

.wa-quick-preview {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Módulo de Correo (PWA) ─────────────────────────────────────────────── */

.mail-pwa-account-form { margin-bottom: 12px; }

.mail-pwa-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
}

.mail-pwa-folders {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mail-pwa-folder-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s, color .12s;
}

.mail-pwa-folder-tab.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.mail-pwa-folder-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(58, 167, 163, 0.12);
  color: var(--teal-dark);
}

/* Lista de mensajes */
.mail-pwa-msg-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.mail-pwa-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}

.mail-pwa-item:hover { background: #f8fafc; }
.mail-pwa-item.is-unread { background: #fff; }

.mail-pwa-item__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mail-pwa-item__avatar.is-unread { background: var(--teal); }

.mail-pwa-item__main { min-width: 0; }

.mail-pwa-item__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.mail-pwa-item__from {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-pwa-item__time {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.mail-pwa-item__subject {
  font-size: 0.82rem;
  color: var(--ink);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-pwa-item__subject.fw-bold { font-weight: 700; }

.mail-pwa-item__preview {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Vista detalle */
.mail-pwa-detail { display: flex; flex-direction: column; gap: 14px; }

.mail-pwa-detail__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mail-pwa-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal-dark);
  text-decoration: none;
  padding: 8px 0;
}

.mail-pwa-msg-card { padding: 0; overflow: hidden; }

.mail-pwa-msg-subject {
  margin: 0;
  padding: 16px 16px 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.mail-pwa-msg-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mail-pwa-msg-meta strong { color: var(--ink); font-weight: 600; margin-right: 4px; }
.mail-pwa-msg-date { color: var(--muted); font-size: 0.76rem; margin-top: 4px; }

.mail-pwa-msg-body { padding: 14px 16px; }

.mail-pwa-iframe {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.mail-pwa-msg-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

/* Panel de respuesta */
.mail-pwa-reply-card { padding: 0; overflow: hidden; }

.mail-pwa-reply-head {
  padding: 12px 16px;
  background: rgba(58, 167, 163, 0.07);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal-dark);
}

.mail-pwa-reply-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  outline: none;
}

.mail-pwa-reply-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #fafbfc;
}

.mail-pwa-btn {
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
}

.mail-pwa-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.mail-pwa-btn--ai {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  color: #fff;
}

.mail-pwa-btn--send {
  background: var(--teal);
  color: #fff;
  margin-left: auto;
}

.mail-pwa-reply-status {
  padding: 8px 16px 12px;
  font-size: 0.82rem;
  font-weight: 600;
}

.mail-pwa-reply-status.is-error { color: #b42318; }
.mail-pwa-reply-status.is-ok { color: #047857; }

.mail-pwa-reply-sent {
  padding: 20px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #047857;
  text-align: center;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  padding: 16px 0;
}
.empty a { color: var(--teal); }


/* ── Cambio de etapa del embudo (ficha del lead) ── */
.stage-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.stage-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(7, 23, 53, .14);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: inherit;
  /* 16px evita que iOS haga zoom al enfocar el select */
  -webkit-appearance: none;
  appearance: none;
}
.stage-select:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(63, 127, 231, .16);
}
.stage-btn {
  flex: 0 0 auto;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--brand-2);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px; /* objetivo táctil cómodo */
}
.stage-btn:active { transform: translateY(1px); }
.stage-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(7, 23, 53, .55);
  line-height: 1.5;
}

/* ══ WhatsApp a pantalla completa (chat abierto, ?c=N) ══════════════════════
   La clase la pone el servidor en <body> (layout.php). Sin topbar ni footer:
   la salida es la flecha ‹ del propio chat, igual que en la app real. El alto
   real lo calcula fitWhatsAppShell() midiendo el top del shell, así que basta
   con quitar lo que hay encima. */
body.wa-fullscreen .app-topbar { display: none; }
body.wa-fullscreen .app-shell {
  padding: 0;
  height: var(--app-vh, 100dvh);
  min-height: var(--app-vh, 100dvh);
}
body.wa-fullscreen .notice { margin: 0; border-radius: 0; }
body.wa-fullscreen .wa-app-shell,
body.wa-fullscreen .wa-app-shell .wa-chat-panel {
  height: var(--wa-shell-height, var(--app-vh, 100dvh));
  /* ⚠️ Sin estos dos, la barra de escribir se quedaba TAPADA hasta que tocabas
     la pantalla. `.wa-app-shell` trae `max-height: calc(var(--app-vh) - 76px)`
     y `min-height`, restos de cuando esta pantalla tenía topbar y barra de
     navegación. Aquí no hay ninguna de las dos y `fitWhatsAppShell()` ya mide
     el alto exacto, así que ese tope solo servía para recortar: el panel medía
     el alto completo, el shell 76px menos y, con `overflow:hidden`, lo que se
     comía era justo el compose — dejando debajo una franja del fondo de la
     página. Se veía bien al tocar el campo porque `body.wa-keyboard-open` ya
     anulaba estos mismos dos topes; esto lo hace también con el teclado
     cerrado, que es el 100% del tiempo antes del primer toque. */
  min-height: 0;
  max-height: none;
  border-radius: 0;
}
/* El header del chat asume el hueco de la cámara/notch al no haber topbar. */
body.wa-fullscreen .wa-chat-header {
  padding-top: calc(10px + env(safe-area-inset-top));
}
body.wa-fullscreen .wa-compose {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* ══ Menú ⋮ de la barra de escritura ═══════════════════════════════════════ */
.wa-compose-menu {
  position: relative;
  flex: 0 0 auto;
}
.wa-compose-menu > summary {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  color: #54656f;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.wa-compose-menu > summary::-webkit-details-marker { display: none; }
.wa-compose-menu[open] > summary { background: #e7eaee; }

/* Panel flotante hacia arriba, pegado al kebab. */
.wa-compose-menu-panel {
  position: absolute;
  bottom: 54px;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 6px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}
.wa-compose-menu-panel .wa-attach-button,
.wa-compose-menu-panel .wa-record-button,
.wa-compose-menu-panel .wa-quick-open,
.wa-compose-menu-panel .wa-template-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: auto;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: #111b21;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.wa-compose-menu-panel .wa-attach-button:active,
.wa-compose-menu-panel .wa-record-button:active,
.wa-compose-menu-panel .wa-quick-open:active,
.wa-compose-menu-panel .wa-template-toggle:active { background: #f0f2f5; }
.wa-compose-menu-panel i {
  font-style: normal;
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}
.wa-compose-menu-panel .wa-record-button.is-recording {
  background: #fee2e2;
  color: #b91c1c;
}
.wa-compose-menu-panel [disabled],
.wa-compose-menu-panel label:has(input[disabled]) {
  opacity: 0.45;
  pointer-events: none;
}

/* ══ Chat despejado: buscador, rápidos y plantillas ocultos por defecto ═════ */
.wa-thread-search[hidden],
.wa-quick-box[hidden] {
  display: none !important;
}

/* Con la ventana 24h abierta la caja de plantillas no ocupa sitio: solo existe
   cuando el menú ⋮ la abre (el toggle alterna el atributo open del details). */
.wa-template-box--oculta:not([open]) {
  display: none;
}

/* Cinturón y tirantes: en pantalla completa NADA fijo del layout general puede
   flotar sobre el chat (el sheet translúcido que tapaba la barra de escribir). */
body.wa-fullscreen .bottom-nav,
body.wa-fullscreen .fab,
body.wa-fullscreen .floating-cta {
  display: none !important;
}

/* Long-press sin que iOS seleccione el texto ni saque su lupa. */
.wa-message-thread .wa-bubble {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* En modo selección el cursor del hilo lo deja claro. */
.wa-forward-mode .wa-bubble { cursor: pointer; }

/* El display:flex de la barra pisaba el atributo hidden: la barra de
   "N seleccionados" se veía SIEMPRE aunque el modo selección estuviera apagado. */
.wa-forward-bar[hidden],
.wa-notes-banner[hidden] {
  display: none !important;
}

/* ── Aviso de "hay una versión nueva" ─────────────────────────────────────
   Va abajo y no arriba: en la pantalla de WhatsApp la cabecera es la del chat
   y un banner encima la taparía. Se apoya sobre la barra de navegación, y
   cuando esa barra no está (chat a pantalla completa) baja a ras del borde. */
.app-update-bar {
  position: fixed;
  right: 10px;
  left: 10px;
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 50;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  box-shadow: 0 18px 42px rgba(58, 167, 163, 0.34);
  color: #fff;
}
/* En la LISTA de chats no hay barra de navegación, así que el aviso puede bajar
   hasta el borde. */
body.whatsapp-screen .app-update-bar {
  bottom: max(12px, calc(env(safe-area-inset-bottom) + 12px));
}
/* ⚠️ Pero en un CHAT ABIERTO ese hueco es el campo de escribir. Estos avisos van
   en `position: fixed`, así que se le ponían encima y tapaban el input — el
   mismo síntoma que veníamos arreglando, pero causado por el propio aviso. Y el
   de actualizar sale justo al publicar una versión, o sea en el peor momento.
   Aquí se ocultan: se verán en la lista de chats y en el resto de la app, que es
   de sobra. Escribirle a un cliente manda sobre cualquier aviso nuestro. */
body.wa-fullscreen .app-update-bar,
body.wa-fullscreen .app-install-bar {
  display: none;
}
.app-update-bar__text {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}
.app-update-bar__btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
}
.app-update-bar__btn[disabled] { opacity: .7; }
.app-update-bar__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
}
/* Obligatoria: sin botón de cerrar y en ámbar, para que se lea distinto de un
   aviso que se puede posponer. */
.app-update-bar.is-required {
  background: linear-gradient(135deg, var(--amber), #d99420);
  box-shadow: 0 18px 42px rgba(242, 179, 61, 0.36);
}
.app-update-bar.is-required .app-update-bar__btn { color: #8a5a05; }

/* ── Invitación a instalar la app ─────────────────────────────────────────
   Mismo sitio que el aviso de actualizar, pero en claro: aquello es una
   acción pendiente y esto es una sugerencia. Nunca salen a la vez (lo
   comprueba el JS antes de pintar). */
.app-install-bar {
  position: fixed;
  right: 10px;
  left: 10px;
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 49;
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 46px rgba(7, 23, 53, 0.18);
  backdrop-filter: blur(18px);
}
body.whatsapp-screen .app-install-bar {
  bottom: max(12px, calc(env(safe-area-inset-bottom) + 12px));
}
.app-install-bar__text { flex: 1; min-width: 0; }
.app-install-bar__text strong { display: block; font-size: 0.88rem; color: var(--ink); }
.app-install-bar__text span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.app-install-bar__text span strong { display: inline; color: var(--ink); font-size: inherit; }
.app-install-bar__actions { display: grid; flex: 0 0 auto; gap: 6px; justify-items: stretch; }
.app-install-bar__btn {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}
.app-install-bar__btn[disabled] { opacity: .6; }
.app-install-bar__later {
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Visor de fotos del chat ──────────────────────────────────────────────
   Por encima del drawer (60) para que nada se cuele por delante. */
.wa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(4, 10, 22, 0.94);
  /* La foto manda: se le da todo el hueco disponible. */
  grid-template-rows: 1fr;
}
.wa-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  object-fit: contain;
  /* Sin la caja fija de la miniatura: aquí se ve al tamaño que tenga. */
  aspect-ratio: auto;
  background: transparent;
}
.wa-lightbox__close {
  position: absolute;
  top: max(12px, calc(env(safe-area-inset-top) + 6px));
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.1rem;
}
.wa-lightbox__open {
  position: absolute;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}
/* El fondo no se desplaza mientras el visor está abierto. */
body.has-lightbox { overflow: hidden; }
/* La miniatura invita a tocarse. */
.wa-media-image { cursor: zoom-in; }

/* ── Adjuntar y audio, ahora en la propia barra de escribir ───────────────
   Dentro del kebab llevaban etiqueta de texto ("Adjuntar", "Audio"); en la
   barra son botones redondos de icono, así que la etiqueta sobra. La regla
   apunta solo a los que son hijos DIRECTOS de .wa-compose: los que siguen
   dentro del menú conservan su texto. */
.wa-compose > .wa-attach-button span,
.wa-compose > .wa-record-button span {
  display: none;
}
.wa-compose > .wa-attach-button,
.wa-compose > .wa-record-button {
  position: relative;
  overflow: hidden;
}
/* El <input type="file"> va dentro del label: se oculta sin sacarlo del DOM
   (display:none en algunos navegadores impide abrir el selector). */
.wa-compose > .wa-attach-button .wa-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Con el clip y el micrófono ya en la barra son CINCO controles. Medido: con el
   `padding` del formulario quedan 336px útiles en un móvil de 360 y los tamaños
   base pedían 350 → el botón de enviar se caía a una segunda fila. Se baja la
   base del cuadro de texto (sigue creciendo para quedarse el sobrante) y el
   hueco entre controles, y todo entra en UNA fila. */
.wa-compose { gap: 8px; }
.wa-compose > textarea { flex: 1 1 90px; }
/* La vista previa del adjunto sí ocupa su propia línea. */
.wa-compose > .wa-file-preview { flex: 0 0 100%; }

/* La campana salió del enlace del perfil: antes iba dentro y pulsarla abría el
   perfil, no los avisos. Ahora es un hermano más del topbar, que reparte con
   space-between, así que sin este margin-left:auto se quedaría en el centro en
   vez de pegada a la foto. */
.top-bell { display: inline-flex; align-items: center; margin-left: auto; margin-right: 14px; text-decoration: none; }
