:root {
  color-scheme: light;
  --magenta: #D91EAE;
  --magenta-deep: #B0148B;
  --magenta-ink: #A3127F;      /* texto magenta pequeño, AA sobre blanco */
  --magenta-soft: #FCE8F7;
  --lime: #A3C41F;
  --lime-deep: #8BAA12;
  --lime-ink: #55690C;          /* texto verde pequeño, AA */
  --lime-soft: #F1F7DC;
  --bg: #F4F1F3;
  --card: #FFFFFF;
  --ink: #26303B;
  --slate: #5D6E7F;
  --muted: #8A97A4;
  --line: rgba(38, 48, 59, 0.08);
  --amber: #E8930C;
  --amber-soft: #FFF3DD;
  --red: #D64545;
  --red-soft: #FDECEC;
  --wa-green: #25D366;
  --wa-bubble: #D9FDD3;
  --wa-tick: #53BDEB;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow-1: 0 1px 2px rgba(38, 48, 59, .05), 0 4px 14px rgba(38, 48, 59, .06);
  --shadow-2: 0 2px 6px rgba(38, 48, 59, .06), 0 18px 40px rgba(38, 48, 59, .12);
  --shadow-3: 0 30px 80px rgba(30, 10, 30, .28);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 400 1rem/1.5 var(--font); color: var(--slate); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23D91EAE' fill-opacity='.045'%3E%3Cg transform='translate(24 28) rotate(-18)'%3E%3Cellipse cx='12' cy='18' rx='8' ry='7'/%3E%3Ccircle cx='3' cy='7' r='3.2'/%3E%3Ccircle cx='9.5' cy='2' r='3.2'/%3E%3Ccircle cx='16.5' cy='2' r='3.2'/%3E%3Ccircle cx='22' cy='7.5' r='3.2'/%3E%3C/g%3E%3Cg transform='translate(104 102) rotate(22)'%3E%3Cellipse cx='12' cy='18' rx='8' ry='7'/%3E%3Ccircle cx='3' cy='7' r='3.2'/%3E%3Ccircle cx='9.5' cy='2' r='3.2'/%3E%3Ccircle cx='16.5' cy='2' r='3.2'/%3E%3Ccircle cx='22' cy='7.5' r='3.2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 600; }
b, strong { font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--magenta) 55%, transparent); outline-offset: 2px; border-radius: 10px; }

/* ---------- Barra superior: material translúcido ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: 0 1px 0 rgba(38, 48, 59, .06);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand img { width: 44px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { color: var(--ink); font-size: .98rem; letter-spacing: -.01em; }
.brand-text span { color: var(--muted); font-size: .74rem; letter-spacing: .02em; }
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 0 auto;
  background: rgba(38, 48, 59, .07); border-radius: 999px; padding: 3px; min-width: 0;
}
.segmented button {
  position: relative; z-index: 1; border: 0; background: none; padding: 8px 16px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; color: var(--slate); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .2s ease;
}
.segmented button[aria-selected="true"] { color: var(--ink); }
.segmented button:active { transform: scale(.97); }
.seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06); will-change: transform; }
.seg-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--magenta); color: #fff; font-size: .72rem; line-height: 20px; text-align: center; }
.seg-count.zero { background: var(--lime); }
.demo-badge { flex: none; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--magenta-ink); background: var(--magenta-soft); padding: 5px 10px; border-radius: 999px; }

main { max-width: 1120px; margin: 0 auto; padding: 20px var(--gutter) 40px; }
.view { will-change: transform, opacity; }

/* ---------- Héroe ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 26px 24px 22px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #F04BC8 0%, var(--magenta) 45%, #B4108E 100%);
  box-shadow: 0 20px 50px rgba(217, 30, 174, .28);
}
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; background: url(../img/logo_stack_ondark.png) center/contain no-repeat; opacity: .12; transform: rotate(-10deg); pointer-events: none; }
.hero-eyebrow { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.hero h1 { color: #fff; font-size: clamp(1.7rem, 4.6vw, 2.5rem); line-height: 1.08; letter-spacing: -.025em; margin: 6px 0 4px; }
.hero-sub { opacity: .92; font-size: .98rem; max-width: 46ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; position: relative; z-index: 1; }
.stat { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 18px; padding: 12px 14px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.stat b { display: block; font-size: 1.9rem; line-height: 1; letter-spacing: -.03em; color: #fff; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .78rem; margin-top: 6px; opacity: .92; line-height: 1.25; }
.stat.lime b { color: #E4F59A; }

.value-banner {
  display: flex; gap: 14px; align-items: center; margin: 16px 0 6px; padding: 14px 16px; border-radius: 18px;
  background: var(--card); box-shadow: var(--shadow-1); border: 1px solid var(--line);
}
.value-banner .vb-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--lime-soft); display: grid; place-items: center; font-size: 1.25rem; }
.value-banner p { font-size: .92rem; color: var(--slate); }
.value-banner b { color: var(--ink); }

/* ---------- Filtros ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.toolbar h2 { font-size: 1.25rem; letter-spacing: -.015em; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip-btn { border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600; color: var(--slate); white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-btn:active { transform: scale(.96); }
.chip-btn .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Tarjetas de seguimiento ---------- */
.queue { display: grid; grid-template-columns: minmax(0, 1fr); }
.fu-wrap, .fu { min-width: 0; }
.angle-pill.m-only { display: none; }
@media (min-width: 900px) { .queue { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; } }
.fu-wrap { padding-bottom: 14px; }
.fu {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); border: 1px solid var(--line);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; transform-origin: 50% 0;
}
.fu-head { display: flex; gap: 12px; align-items: center; }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: var(--tone, #eee); display: grid; place-items: center; font-size: 1.6rem; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.fu-who { min-width: 0; flex: 1; }
.fu-who h3 { font-size: 1.05rem; letter-spacing: -.01em; display: flex; gap: 6px; align-items: baseline; }
.fu-who h3 small { font-weight: 400; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-who p { font-size: .84rem; color: var(--slate); line-height: 1.35; }
.angle-pill { flex: none; align-self: flex-start; font-size: .75rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--magenta-soft); color: var(--magenta-ink); white-space: nowrap; }
.trigger { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: .76rem; font-weight: 600; padding: 4px 9px; border-radius: 8px; background: #F2F4F6; color: var(--slate); display: inline-flex; gap: 5px; align-items: center; }
.tag.vencida { background: var(--red-soft); color: #A22F2F; }
.tag.pronto { background: var(--amber-soft); color: #8A5300; }
.tag.info { background: var(--lime-soft); color: var(--lime-ink); }
.bubble-preview {
  position: relative; background: #EFEAE2; border-radius: 16px; padding: 12px;
}
.bubble-preview .bp-label { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.bubble { background: var(--wa-bubble); color: #111B21; border-radius: 12px 12px 4px 12px; padding: 9px 11px 7px; font-size: .93rem; line-height: 1.42; box-shadow: 0 1px 1px rgba(0,0,0,.06); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble textarea { width: 100%; min-height: 110px; border: 0; background: transparent; font: inherit; color: inherit; resize: vertical; outline: none; padding: 0; }
.variants { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.variants .lbl { font-size: .76rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.var-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: .8rem; font-weight: 600; color: var(--slate); }
.var-btn[aria-pressed="true"] { border-color: var(--magenta); color: var(--magenta-ink); background: var(--magenta-soft); }
.actions { display: flex; gap: 8px; align-items: center; }
.btn {
  border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s ease-out, background .2s, box-shadow .2s; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-primary { flex: 1; white-space: nowrap; min-width: 0; background: var(--magenta); color: #fff; box-shadow: 0 6px 16px rgba(217, 30, 174, .3); }
.btn-primary:hover { background: var(--magenta-deep); }
.btn-quiet { background: #F2F4F6; color: var(--ink); padding: 12px; }
.btn-quiet:hover { background: #E8EBEF; }
.btn-quiet svg { width: 20px; height: 20px; }
.btn-lime { background: var(--lime); color: #263000; }
.btn svg { width: 18px; height: 18px; flex: none; }

.fu.sent { gap: 10px; }
.sent-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .86rem; }
.ok-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--lime); color: #fff; display: grid; place-items: center; flex: none; }
.ok-dot svg { width: 14px; height: 14px; }
.outcome { display: flex; gap: 10px; align-items: center; background: var(--lime-soft); border-radius: 14px; padding: 10px 12px; color: var(--lime-ink); font-weight: 600; font-size: .88rem; }
.outcome .oi { font-size: 1.1rem; }
.reply-quote { font-size: .88rem; color: var(--slate); border-left: 3px solid var(--lime); padding-left: 10px; font-style: italic; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .big { font-size: 2.6rem; }
.empty h3 { margin: 8px 0 4px; }

/* ---------- Mascotas ---------- */
.search { position: relative; flex: 1; max-width: 360px; min-width: 200px; }
.search input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 11px 14px 11px 40px; font: inherit; color: var(--ink); box-shadow: var(--shadow-1); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.pet-card {
  text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 12px; transition: transform .12s ease-out, box-shadow .2s;
}
.pet-card:hover { box-shadow: var(--shadow-2); }
.pet-card:active { transform: scale(.98); }
.pet-card .top { display: flex; gap: 12px; align-items: center; }
.pet-card .avatar { width: 64px; height: 64px; }
.pet-card h3 { font-size: 1.1rem; }
.pet-card .meta { font-size: .84rem; color: var(--slate); }
.pet-card .owner { font-size: .82rem; color: var(--muted); }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Capas: velo + hoja ---------- */
#layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.scrim { position: absolute; inset: 0; background: rgba(28, 12, 26, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 760px; height: min(92dvh, 900px);
  background: #FBFAFB; border-radius: 28px 28px 0 0; box-shadow: var(--shadow-3); pointer-events: auto;
  display: flex; flex-direction: column; overflow: hidden; will-change: transform;
}
.sheet-grab { flex: none; padding: 10px 0 4px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grab::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: rgba(38,48,59,.22); }
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(38,48,59,.08); display: grid; place-items: center; color: var(--ink); }
.sheet-close svg { width: 16px; height: 16px; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(28px + var(--safe-b)); -webkit-overflow-scrolling: touch; }

/* Ficha */
.pet-head { display: flex; gap: 16px; align-items: center; padding: 6px 40px 14px 0; touch-action: none; }
.pet-head .avatar { width: 84px; height: 84px; }
.pet-head h2 { font-size: 1.7rem; letter-spacing: -.025em; line-height: 1.1; }
.pet-head .meta { font-size: .92rem; }
.pet-head .owner { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.section { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-top: 12px; box-shadow: 0 1px 2px rgba(38,48,59,.04); }
.section h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: #F6F4F5; border-radius: 14px; padding: 10px 12px; }
.kpi b { display: block; color: var(--ink); font-size: 1.15rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .74rem; color: var(--muted); }
.alert-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.alert-row:first-of-type { border-top: 0; padding-top: 0; }
.alert-row .ai { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 1.05rem; background: var(--amber-soft); }
.alert-row.vencida .ai { background: var(--red-soft); }
.alert-row.info .ai { background: var(--lime-soft); }
.alert-row .at { flex: 1; min-width: 0; }
.alert-row .at b { color: var(--ink); font-size: .93rem; display: block; }
.alert-row .at span { font-size: .8rem; color: var(--muted); }
.mini-btn { flex: none; border: 0; border-radius: 11px; padding: 8px 12px; font-weight: 600; font-size: .82rem; background: var(--magenta); color: #fff; white-space: nowrap; }
.mini-btn:active { transform: scale(.96); }
.mini-btn.done { background: var(--lime-soft); color: var(--lime-ink); }
.mini-btn.queued { background: #F2F4F6; color: var(--slate); }
.list-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.list-row:first-of-type { border-top: 0; padding-top: 0; }
.list-row .l b { color: var(--ink); display: block; font-size: .92rem; }
.list-row .l span { color: var(--muted); font-size: .8rem; }
.status { font-size: .74rem; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.status.al_dia { background: var(--lime-soft); color: var(--lime-ink); }
.status.pronto { background: var(--magenta-soft); color: var(--magenta-ink); }
.status.vencida { background: var(--red-soft); color: #A22F2F; }
.cita-card { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, var(--lime-soft), #fff); border: 1px solid #DDEAB0; border-radius: 16px; padding: 12px 14px; }
.cita-card .cal { flex: none; width: 50px; border-radius: 12px; overflow: hidden; text-align: center; background: #fff; box-shadow: var(--shadow-1); }
.cita-card .cal i { display: block; font-style: normal; background: var(--magenta); color: #fff; font-size: .66rem; font-weight: 600; text-transform: uppercase; padding: 2px 0; }
.cita-card .cal b { display: block; color: var(--ink); font-size: 1.3rem; padding: 2px 0 4px; }
.cita-card .ct b { color: var(--ink); display: block; }
.cita-card .ct span { font-size: .84rem; color: var(--slate); }
.timeline .list-row .l b { font-weight: 600; }
.treat { font-size: .93rem; color: var(--ink); }

/* Gráfico de peso */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: rgba(38,48,59,.07); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .band { fill: var(--lime); opacity: .22; }
.chart .band-label { fill: var(--lime-ink); font-size: 10.5px; font-weight: 600; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--magenta); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#wgrad); }
.chart .pt { fill: #fff; stroke: var(--magenta); stroke-width: 2.5; }
.chart .pt-label { fill: var(--ink); font-size: 11px; font-weight: 600; font-family: var(--font); }
.trend { font-size: .8rem; font-weight: 600; padding: 4px 9px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.trend.up { background: var(--red-soft); color: #A22F2F; }
.trend.down { background: var(--amber-soft); color: #8A5300; }
.trend.ok { background: var(--lime-soft); color: var(--lime-ink); }

/* ---------- Simulación WhatsApp ---------- */
.sim { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; pointer-events: none; }
.sim > * { pointer-events: auto; }
.sim-caption { color: #fff; text-align: center; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
.sim-caption b { display: block; font-size: 1.1rem; }
.sim-caption span { font-size: .85rem; opacity: .9; }
.phone {
  width: min(360px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 190px)); min-height: 440px;
  background: #0E0E10; border-radius: 46px; padding: 10px; box-shadow: var(--shadow-3), inset 0 0 0 2px #2A2A2E;
  will-change: transform;
}
.screen { position: relative; height: 100%; border-radius: 37px; overflow: hidden; display: flex; flex-direction: column; background: #EFEAE2; }
.wa-status { flex: none; height: 34px; padding: 0 26px; display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 600; color: #111; background: #F6F5F3; }
.wa-status .island { width: 92px; height: 24px; border-radius: 14px; background: #0E0E10; }
.wa-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px; background: #F6F5F3; border-bottom: 1px solid rgba(0,0,0,.06); }
.wa-head .back { color: #0A7CFF; font-size: 1.3rem; line-height: 1; }
.wa-head img { width: 36px; height: 36px; border-radius: 50%; }
.wa-head b { color: #111B21; font-size: .95rem; display: flex; align-items: center; gap: 4px; }
.wa-head b svg { width: 14px; height: 14px; color: var(--wa-green); }
.wa-head span { font-size: .74rem; color: #667781; display: block; }
.wa-chat {
  flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px;
  background-color: #EFEAE2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23000' fill-opacity='.035'%3E%3Ccircle cx='20' cy='20' r='3'/%3E%3Ccircle cx='80' cy='50' r='2'/%3E%3Ccircle cx='50' cy='95' r='3'/%3E%3Ccircle cx='105' cy='100' r='2'/%3E%3C/g%3E%3C/svg%3E");
}
.wa-day { align-self: center; background: #fff; color: #54656F; font-size: .72rem; padding: 4px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.05); margin-bottom: 6px; }
.wa-sys { align-self: center; background: #FFF5C4; color: #54656F; font-size: .72rem; padding: 6px 10px; border-radius: 8px; text-align: center; max-width: 88%; }
.msg { max-width: 82%; padding: 7px 9px 5px; border-radius: 10px; font-size: .9rem; line-height: 1.38; color: #111B21; box-shadow: 0 1px 1px rgba(0,0,0,.07); white-space: pre-wrap; overflow-wrap: anywhere; will-change: transform, opacity; }
.msg.out { align-self: flex-end; background: var(--wa-bubble); border-top-right-radius: 3px; transform-origin: 100% 100%; }
.msg.in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; transform-origin: 0 100%; }
.msg .mt { float: right; margin: 6px 0 -2px 10px; font-size: .68rem; color: #667781; display: inline-flex; align-items: center; gap: 3px; }
.ticks { width: 17px; height: 11px; color: #8696A0; transition: color .3s ease; }
.ticks.read { color: var(--wa-tick); }
.ticks .t2 { opacity: 0; transition: opacity .2s ease; }
.ticks.double .t2 { opacity: 1; }
.typing { align-self: flex-start; background: #fff; border-radius: 10px; padding: 10px 12px; display: flex; gap: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.07); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9AA6AD; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.wa-event { align-self: center; width: 88%; background: #fff; border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.08); border: 1px solid #E3EEC0; }
.wa-event .ei { width: 34px; height: 34px; border-radius: 10px; background: var(--lime); display: grid; place-items: center; color: #fff; flex: none; }
.wa-event .ei svg { width: 18px; height: 18px; }
.wa-event b { display: block; color: #111B21; font-size: .84rem; }
.wa-event span { font-size: .76rem; color: #54656F; }
.wa-input { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 10px 14px; background: #F6F5F3; }
.wa-input div { flex: 1; background: #fff; border-radius: 18px; padding: 8px 12px; font-size: .82rem; color: #8696A0; }
.wa-input i { width: 34px; height: 34px; border-radius: 50%; background: var(--wa-green); flex: none; }
.sim-actions { display: flex; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.sim-actions .btn { flex: 1; }
.btn-glass { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.btn-white { background: #fff; color: var(--magenta-ink); }
.btn[disabled] { opacity: .55; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 80; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 var(--gutter); }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: center; max-width: 100%;
  background: rgba(30, 34, 40, .88); color: #fff; padding: 10px 12px 10px 14px; border-radius: 18px; font-size: .9rem;
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); box-shadow: var(--shadow-2);
}
.toast .ti { font-size: 1.15rem; }
.toast b { color: #fff; }
.toast button { border: 0; background: rgba(255,255,255,.16); color: #fff; border-radius: 10px; padding: 6px 10px; font-weight: 600; font-size: .82rem; }

/* ---------- Pie ---------- */
.foot { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter) calc(30px + var(--safe-b)); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.foot b { color: var(--slate); }
.link { border: 0; background: none; color: var(--magenta-ink); font-weight: 600; padding: 0; font-size: .8rem; }

/* ---------- Teléfono / pantallas pequeñas ---------- */
@media (max-width: 640px) {
  .brand-text { display: none; }
  .brand img { width: 40px; }
  .segmented button { padding: 8px 12px; font-size: .86rem; }
  .demo-badge { padding: 4px 8px; font-size: .64rem; }
  main { padding-top: 14px; }
  .hero { padding: 22px 18px 18px; border-radius: 24px; }
  .stat { padding: 10px; }
  .stat b { font-size: 1.55rem; }
  .stat span { font-size: .72rem; }
  .sheet { height: 94dvh; }
  .sheet-body { padding: 4px 16px calc(24px + var(--safe-b)); }
  .pet-head .avatar { width: 68px; height: 68px; }
  .pet-head h2 { font-size: 1.45rem; }
  .kpi b { font-size: 1rem; }
  .fu-head .angle-pill { display: none; }
  .angle-pill.m-only { display: inline-flex; align-self: center; }
  .fu { padding: 14px; }
}
@media (max-width: 420px) { .actions .btn-primary svg { display: none; } .actions .btn-quiet { padding: 11px; } .actions { gap: 6px; } }
@media (max-width: 370px) { .seg-count { display: none; } }

@media (prefers-reduced-transparency: reduce) {
  .topbar { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { background: #1E2228; }
}
@media (prefers-reduced-motion: reduce) {
  .typing i { animation: none; }
  .btn:active, .chip-btn:active, .pet-card:active, .segmented button:active { transform: none; }
}

/* ---------- Tutorial ---------- */
.tut-btn { flex: none; border: 0; border-radius: 999px; padding: 7px 13px; background: var(--magenta); color: #fff; font-weight: 600; font-size: .82rem; white-space: nowrap; box-shadow: 0 4px 12px rgba(217,30,174,.28); transition: transform .1s ease-out; }
.tut-btn:active { transform: scale(.96); }
.tut { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.tut .tut-scrim { pointer-events: auto; }
.tut-panel {
  position: relative; width: min(980px, 100%); height: min(700px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background: #FBFAFB; border-radius: 28px; box-shadow: var(--shadow-3); overflow: hidden;
}
.tut-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.tut-top h2 { font-size: 1.25rem; letter-spacing: -.015em; }
.tut-kicker { font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--magenta-ink); }
.tut-close { position: static; flex: none; }
.tut-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; padding: 10px 20px 14px; }
.tut-stage { min-height: 0; overflow-y: auto; scrollbar-width: none; border-radius: 22px; background: var(--bg); padding: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.tut-stage::-webkit-scrollbar { display: none; }
.tut-mock { pointer-events: none; }
.tut-mock [data-hl] { transition: opacity .35s ease, filter .35s ease, box-shadow .35s ease; border-radius: 16px; }
.tut-mock.dim [data-hl] { opacity: .28; filter: saturate(.5); }
.tut-mock.dim [data-hl].hl { opacity: 1; filter: none; box-shadow: 0 0 0 3px var(--magenta), 0 0 0 9px rgba(217,30,174,.16); }
.tut-mock.dim .hl [data-hl] { opacity: 1; filter: none; }
.tut-mock .hero { padding: 20px 18px 16px; }
.tut-mock .hero h1 { font-size: 1.5rem; }
.tut-mock .stats { border-radius: 18px; }
.tut-mock .fu-head .angle-pill { display: inline-flex; }
.tut-mock .fu-head { padding: 4px; margin: -4px; }
.tut-mock .trigger, .tut-mock .variants, .tut-mock .chips { padding: 4px; margin: -4px; }
.tut-mock .chips { margin-bottom: 8px; }
.tut-sec { display: flex; gap: 8px; border-radius: 14px; }
.tut-ficha .pet-head { padding-right: 0; }
.tut-ficha .section { margin-top: 10px; }
.tut-approve { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.tut-approve-left { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.tut-approve-left .btn { width: 100%; }
.tut-approve-left p { font-size: .85rem; text-align: center; }
.tut-phone { width: 100%; height: 400px; min-height: 0; border-radius: 34px; padding: 8px; }
.tut-phone .screen { border-radius: 27px; }
.tut-phone .wa-chat { gap: 8px; }
.tut-phone .msg { font-size: .76rem; max-width: 88%; }
.tut-m { opacity: 0; transform: translateY(8px) scale(.96); }
.tut-m.show { animation: tutMsg .45s cubic-bezier(.2,.9,.3,1.15) forwards; animation-delay: calc(var(--d) * 1.6s + .4s); }
@keyframes tutMsg { to { opacity: 1; transform: none; } }
.tut-points { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-direction: column; gap: 10px; counter-reset: p; align-self: center; }
.tut-points li { counter-increment: p; display: flex; gap: 12px; align-items: flex-start; font-size: 1.08rem; line-height: 1.35; color: var(--ink); font-weight: 600; letter-spacing: -.01em; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-1); }
.tut-points li::before { content: counter(p); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--magenta-soft); color: var(--magenta-ink); font-size: .82rem; display: grid; place-items: center; margin-top: 1px; }
.tut-foot { padding: 10px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); background: rgba(255,255,255,.7); }
.tut-bars { display: flex; gap: 5px; margin-bottom: 12px; }
.tut-bar { flex: 1; height: 14px; border: 0; padding: 5px 0; background: none; cursor: pointer; }
.tut-bar i { display: block; height: 4px; border-radius: 3px; background: var(--magenta); transform-origin: 0 50%; transform: scaleX(0); box-shadow: 0 0 0 100vmax rgba(38,48,59,.1) inset; position: relative; }
.tut-bar { position: relative; }
.tut-bar::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 4px; border-radius: 3px; background: rgba(38,48,59,.12); }
.tut-ctrls { display: flex; gap: 8px; justify-content: flex-end; }
.tut-ctrls .btn { white-space: nowrap; flex: none; }
.tut-ctrls .btn-primary { flex: none; min-width: 140px; }
.tut-ctrls [disabled] { opacity: .4; }
.tut-start { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(251,250,251,.62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); cursor: pointer; }
.tut-start-btn { border: 0; border-radius: 999px; padding: 18px 30px; background: var(--magenta); color: #fff; font-weight: 600; font-size: 1.15rem; display: inline-flex; gap: 12px; align-items: center; box-shadow: 0 16px 40px rgba(217,30,174,.38); }
.tut-start-btn span { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: .9rem; padding-left: 3px; }
.tut-start-btn:active { transform: scale(.97); }
.tut-start p { font-size: .9rem; color: var(--slate); font-weight: 600; }

@media (max-width: 760px) {
  .tut { padding: 0; place-items: end center; }
  .tut-panel { border-radius: 26px 26px 0 0; max-height: 100dvh; height: 100dvh; }
  .tut-top { padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 4px; }
  .tut-top h2 { font-size: 1.05rem; }
  .tut-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 12px; padding: 8px 16px 10px; }
  .tut-stage { padding: 12px; }
  .tut-points { gap: 6px; }
  .tut-points li { font-size: .92rem; padding: 9px 12px; border-radius: 14px; }
  .tut-points li::before { width: 22px; height: 22px; font-size: .74rem; }
  .tut-foot { padding: 8px 16px calc(12px + var(--safe-b)); }
  .tut-ctrls .btn { padding: 11px 12px; font-size: .88rem; }
  .tut-ctrls .btn-primary { min-width: 0; flex: 1; }
  .tut-approve { grid-template-columns: 1fr; }
  .tut-phone { height: 330px; }
}
@media (max-width: 640px) { .tut-btn span { display: none; } .tut-btn { padding: 7px 11px; } }
.tut-phone .wa-head { padding: 10px 10px 8px; }
.tut-phone .wa-head img { width: 30px; height: 30px; }
.tut-phone .wa-head b { font-size: .8rem; white-space: nowrap; }
.tut-phone .wa-head span { font-size: .66rem; }
@media (max-width: 760px) {
  .tut-mock .fu-head { flex-wrap: wrap; }
  .tut-mock .fu-head .angle-pill { order: 3; margin-left: 64px; }
}

/* ---------- Proponer plantilla ---------- */
.meta-ok { color: var(--lime-ink); text-transform: none; letter-spacing: 0; font-weight: 600; }
.var-btn.pending { border-style: dashed; color: #8A5300; background: var(--amber-soft); border-color: #F0C77A; }
.tf-head { display: flex; gap: 12px; align-items: center; padding: 6px 40px 10px 0; }
.tf-head h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.tf-head p { font-size: .88rem; }
.tf-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--magenta-soft); color: var(--magenta-ink); display: grid; place-items: center; }
.tf-icon svg { width: 20px; height: 20px; }
.tf-progress { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tf-progress span { font-size: .75rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: #F0EEF0; color: var(--muted); }
.tf-progress span.on { background: var(--magenta); color: #fff; }
.tf-progress span.done { background: var(--lime-soft); color: var(--lime-ink); }
.tf-rule { font-size: .88rem; line-height: 1.5; background: var(--amber-soft); border: 1px solid #F6DBA8; color: #6B4A10; border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }
.tf-rule b { color: #5A3C05; }
.tf-rule.soft { background: var(--lime-soft); border-color: #DDEAB0; color: var(--lime-ink); margin-top: 12px; }
.tf-rule.soft b { color: #3F4F08; }
.tf-label { display: block; font-weight: 600; color: var(--ink); font-size: .9rem; margin-bottom: 6px; }
.tf-text { width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; font: inherit; font-size: .95rem; line-height: 1.5; color: #111B21; background: var(--wa-bubble); resize: vertical; box-shadow: inset 0 1px 2px rgba(0,0,0,.04); }
.tf-text:focus { outline: 3px solid color-mix(in srgb, var(--magenta) 40%, transparent); }
.tf-hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.tf-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.tf-actions .btn-primary { flex: none; }
.tf-actions .btn[disabled] { opacity: .45; }
.tf-thinking { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 16px; text-align: center; }
.tf-thinking b { color: var(--ink); font-size: 1.05rem; }
.tf-thinking span { font-size: .88rem; }
.tf-spark { font-size: 2.2rem; animation: spark 1.2s ease-in-out infinite; }
@keyframes spark { 50% { transform: scale(1.18) rotate(12deg); } }
.tf-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow-1); }
.tf-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.tf-meta small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tf-meta b { font-size: .88rem; color: var(--ink); overflow-wrap: anywhere; }
.tf-body { background: #F6F4F5; border-radius: 14px; padding: 12px; font-size: .92rem; line-height: 1.75; color: #111B21; white-space: pre-wrap; overflow-wrap: anywhere; }
.var-pill { display: inline; background: var(--magenta-soft); color: var(--magenta-ink); border-radius: 8px; padding: 2px 7px; font-weight: 600; font-size: .82rem; white-space: nowrap; }
.var-num { color: var(--magenta-ink); font-variant-numeric: tabular-nums; }
.tf-ex { font-size: .8rem; color: var(--muted); text-align: right; max-width: 45%; }
.tf-checks { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.tf-check { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; padding: 9px 12px; border-radius: 12px; font-weight: 600; }
.tf-check.ok { background: var(--lime-soft); color: var(--lime-ink); }
.tf-check.warn { background: var(--red-soft); color: #A22F2F; }
.tf-check.info { background: #EEF4FB; color: #2B5A85; }
.tf-done-title { font-size: 1.3rem; font-weight: 600; color: var(--ink); margin: 2px 0 12px; letter-spacing: -.015em; }
.tf-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.tf-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; position: relative; }
.tf-steps li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 36px; bottom: -6px; width: 2px; background: #E8E4E7; }
.tf-steps .dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #EEEBEE; font-size: .8rem; color: #fff; z-index: 1; }
.tf-steps .dot svg { width: 15px; height: 15px; }
.tf-steps li.done .dot { background: var(--lime); }
.tf-steps li.wait .dot { background: var(--amber-soft); }
.tf-steps b { display: block; color: var(--ink); font-size: .92rem; }
.tf-steps li span { font-size: .8rem; color: var(--muted); }
.tf-steps li.todo b { color: var(--muted); }
.nowrap { white-space: nowrap; }
