/* ============================================================
   BoraVoltar — pages.css
   Page-specific patterns (dashboard, clientes, mensagens, etc.)
   ============================================================ */

/* ---------------- Dashboard status columns ---------------- */
.status-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }

.status-col {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.status-col::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--st, var(--primary)); opacity: .85; }
.status-col-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 15px 16px 12px;
}
.status-col-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.status-col-head h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.status-col-head .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.status-col-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; }
.status-col-foot { border-top: 1px solid var(--border-soft); }
.status-col-foot button { width: 100%; height: 46px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); transition: color .14s, background .14s; }
.status-col-foot button:hover { color: var(--primary); background: var(--surface-2); }

/* Client card inside columns */
.cli-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-left: 2.5px solid var(--st, var(--primary));
  border-radius: var(--radius-sm);
  padding: 12px 12px 11px;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.cli-card:hover { background: var(--surface-hover); border-color: var(--border); border-left-color: var(--st); transform: translateX(1px); }
.cli-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cli-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.cli-phone { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.cli-meta { font-size: 12px; color: var(--text-soft); margin-top: 7px; }
.cli-meta .em { color: var(--st); font-weight: 600; }
.cli-card .kebab { color: var(--text-faint); }
.cli-card .kebab:hover { color: var(--text); }
.cli-card-actions { margin-top: 11px; }

/* Dica rápida + progress */
.tip-card { display: flex; align-items: center; gap: 20px; padding: 16px 18px; }
.tip-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--warning-soft); border: 1px solid var(--warning-line); color: var(--warning); display: grid; place-items: center; flex: none; }
.tip-ico svg { width: 20px; height: 20px; }
.tip-text h4 { font-size: 13.5px; }
.tip-text p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.tip-progress { margin-left: auto; min-width: 280px; }
.tip-progress .row-between { margin-bottom: 7px; }
.tip-progress .pv { font-size: 12.5px; color: var(--text-soft); }
.tip-progress .pv b { color: var(--text); font-weight: 700; }
.tip-progress .pct { font-size: 12.5px; font-weight: 700; color: var(--primary); }

/* ---------------- Clientes table page ---------------- */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 13px;
  border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); transition: all .14s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.chip .c-count { font-size: 11px; opacity: .7; }

.cli-row-name { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--st); }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); }

/* ---------------- Cliente detalhe ---------------- */
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 18px; gap: 4px; }
.profile-head .avatar { margin-bottom: 8px; }
.profile-head h2 { font-size: 18px; }
.profile-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-soft); border-top: 1px solid var(--border-soft); }
.profile-stat { background: var(--surface); padding: 14px; text-align: center; }
.profile-stat .v { font-size: 19px; font-weight: 700; }
.profile-stat .l { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.info-row .il { color: var(--text-muted); }
.info-row .iv { margin-left: auto; color: var(--text); font-weight: 500; }

.campaign-client-tools { align-items: end; }
.campaign-client-actions { flex: 0 0 auto; }
.client-picker-row {
  min-height: 64px;
  gap: 11px;
}
.client-picker-check {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
}
.client-picker-check input {
  position: absolute;
  inset: -11px;
  width: 46px !important;
  height: 46px !important;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.client-picker-box {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.client-picker-check input:checked + .client-picker-box {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.client-picker-check input:checked + .client-picker-box::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid var(--primary-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------------- WhatsApp preview ---------------- */
.wa-preview {
  background:
    linear-gradient(rgba(11,17,24,.92), rgba(11,17,24,.92)),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255,255,255,.012) 18px 19px);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
[data-theme="light"] .wa-preview { background: linear-gradient(#dfeae2, #d6e3da); }
.wa-top { display: flex; align-items: center; gap: 11px; padding: 12px 15px; background: var(--whatsapp); color: #fff; }
.wa-top .avatar { background: rgba(255,255,255,.22); color: #fff; }
.wa-top .wa-name { font-size: 14px; font-weight: 600; }
.wa-top .wa-sub { font-size: 11.5px; opacity: .85; }
.wa-body { padding: 20px 16px; min-height: 220px; display: flex; flex-direction: column; gap: 10px; }
.wa-bubble {
  align-self: flex-end; max-width: 84%; background: #d9fdd3; color: #0b1f12;
  padding: 9px 12px 7px; border-radius: 10px 10px 2px 10px; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0,0,0,.12); position: relative;
}
.wa-bubble .wa-time { display: block; text-align: right; font-size: 10.5px; color: #5a7d5f; margin-top: 3px; }
.wa-bubble .var { background: rgba(34,199,247,.18); border-radius: 4px; padding: 0 3px; }

/* template var chips */
.var-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.var-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; padding: 4px 9px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line); cursor: pointer; transition: background .12s; }
.var-chip { min-height: 46px; display: inline-flex; align-items: center; }
.var-chip:hover { background: color-mix(in oklch, var(--primary) 22%, transparent); }

.tmpl-item { min-height: 46px; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); cursor: pointer; transition: background .14s; background: none; }
.tmpl-item:last-child { border-bottom: none; }
.tmpl-item:hover, .tmpl-item.active { background: var(--surface-2); }
.tmpl-item.active { box-shadow: inset 3px 0 0 var(--primary); }
.tmpl-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--st-soft); color: var(--st); border: 1px solid var(--st-line); flex: none; }
.tmpl-ico svg { width: 17px; height: 17px; }
.tmpl-item h4, .tmpl-h4 { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.tmpl-item p, .tmpl-p { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mensagens 3-pane editor */
.msg-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr) 360px; gap: 16px; align-items: start; }

/* ---------------- Reports ---------------- */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.chart-bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars .bar .fill { width: 100%; max-width: 42px; border-radius: 6px 6px 0 0; background: linear-gradient(var(--primary), color-mix(in oklch, var(--primary) 55%, transparent)); position: relative; animation: fadeUpBar .5s ease both; }
@keyframes fadeUpBar { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chart-bars .bar .fill { animation: none; } }
.chart-bars .bar .fill::after { content: attr(data-v); position: absolute; top: -19px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--text-soft); }
.chart-bars .bar .lbl { font-size: 11px; color: var(--text-muted); }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 130px; height: 130px; border-radius: 50%; flex: none; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--surface); }
.donut-legend { display: flex; flex-direction: column; gap: 11px; flex: 1; }
.donut-legend .lg-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.donut-legend .lg-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .lg-val { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.stat-line { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.stat-line:last-child { border-bottom: none; }
.stat-line .sl-label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-soft); }
.stat-line .sl-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--st-soft); color: var(--st); }
.stat-line .sl-ico svg { width: 15px; height: 15px; }
.stat-line .sl-val { font-size: 17px; font-weight: 700; }

/* ---------------- Onboarding ---------------- */
.onb-wrap { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.onb-steps { display: flex; align-items: center; gap: 0; margin-bottom: 34px; }
.onb-step { display: flex; align-items: center; gap: 10px; flex: 1; }
.onb-step:last-child { flex: none; }
.onb-step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.onb-step.done .dot { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.onb-step.active .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.onb-step .lbl { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.onb-step.active .lbl, .onb-step.done .lbl { color: var(--text); font-weight: 500; }
.onb-step .line { height: 1.5px; flex: 1; background: var(--border); }
.onb-step.done .line { background: var(--primary); }

.seg-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 20px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all .15s ease;
}
.seg-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.seg-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary-line); }
.seg-card .sc-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--primary); }
.seg-card.selected .sc-ico { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg-card .sc-ico svg { width: 22px; height: 22px; }
.seg-card h4 { font-size: 14px; }
.seg-card p { font-size: 11.5px; color: var(--text-muted); }

/* ---------------- Landing ---------------- */
.hero { padding: 70px 0 50px; display: grid; grid-template-columns: 1fr 1.05fr; gap: 50px; align-items: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line); }
.hero h1 { font-size: 46px; line-height: 1.06; letter-spacing: -0.03em; margin-top: 20px; }
.hero h1 .accent { color: var(--primary); }
.hero p.lede { font-size: 16.5px; color: var(--text-soft); line-height: 1.6; margin-top: 18px; max-width: 480px; }
.hero-cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 22px; margin-top: 30px; flex-wrap: wrap; }
.hero-trust .ht { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.hero-trust .ht svg { width: 15px; height: 15px; color: var(--success); }

.hero-shot { border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--surface); }
.section { padding: 60px 0; }
.section-eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); text-align: center; }
.section h2 { font-size: 32px; text-align: center; margin-top: 10px; letter-spacing: -0.025em; }
.section .section-sub { font-size: 15px; color: var(--text-muted); text-align: center; max-width: 540px; margin: 12px auto 0; }

.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 42px; }
.feat { padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.feat .f-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--st-soft, var(--primary-soft)); color: var(--st, var(--primary)); border: 1px solid var(--st-line, var(--primary-line)); margin-bottom: 16px; }
.feat .f-ico svg { width: 21px; height: 21px; }
.feat h3 { font-size: 16.5px; }
.feat p { font-size: 13.5px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }

.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 42px; counter-reset: st; }
.step-box { padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); position: relative; }
.step-box .num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; font-weight: 600; color: var(--primary); }
.step-box h3 { font-size: 15px; margin-top: 10px; }
.step-box p { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.55; }

/* Pricing */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 42px; align-items: stretch; }
.price-card { padding: 28px 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--primary-line); box-shadow: var(--shadow-glow); position: relative; }
.price-card.featured::before { content: "Mais popular"; position: absolute; top: -11px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; padding: 3px 12px; border-radius: 99px; background: var(--primary); color: var(--primary-ink); }
.price-card h3 { font-size: 17px; }
.price-card .price { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; margin: 14px 0 2px; }
.price-card .price span { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.price-card .price-sub { font-size: 13px; color: var(--text-muted); }
.price-feats { display: flex; flex-direction: column; gap: 11px; margin: 22px 0; flex: 1; }
.price-feats li { display: flex; gap: 10px; font-size: 13.5px; color: var(--text-soft); }
.price-feats li svg { width: 17px; height: 17px; color: var(--success); flex: none; margin-top: 1px; }

.cta-band { text-align: center; padding: 56px 32px; border-radius: var(--radius-lg); border: 1px solid var(--primary-line); background: radial-gradient(700px 300px at 50% 0%, var(--primary-soft), transparent 70%), var(--surface); }
.cta-band h2 { font-size: 30px; }
.cta-band p { font-size: 15px; color: var(--text-muted); margin-top: 12px; }

/* Health / gov bits */
.health-big { display: flex; align-items: center; gap: 13px; margin-top: 9px; }
.health-big .hb-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--st-soft); color: var(--st); border: 1px solid var(--st-line); }
.health-big .hb-ico svg { width: 21px; height: 21px; }
.health-big .hb-val { font-size: 22px; font-weight: 700; color: var(--st); white-space: nowrap; }
.mini-card { padding: 16px; }
.mini-card .mc-head { display: flex; align-items: center; justify-content: space-between; }
.mini-card .mc-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.mini-card .mc-val { font-size: 26px; font-weight: 700; margin-top: 10px; letter-spacing: -0.02em; }
.mini-card .mc-delta { font-size: 11.5px; font-weight: 600; margin-top: 6px; display: inline-flex; gap: 4px; align-items: center; }
.mini-card .mc-foot { font-size: 11.5px; color: var(--text-faint); margin-top: 9px; }
.mini-card .mc-link { font-size: 12px; font-weight: 600; color: var(--primary); margin-top: 11px; display: inline-flex; align-items: center; gap: 5px; }

.risk-list { display: flex; flex-direction: column; }
.risk-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.risk-row:last-child { border-bottom: none; }
.risk-row .rr-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.risk-row .rr-score { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.worker-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; }
.worker-dots .wd { width: 14px; height: 14px; border-radius: 4px; background: var(--success); }
.worker-dots .wd.busy { background: var(--warning); }
.worker-dots .wd.off { background: var(--surface-hover); border: 1px solid var(--border); }

.flag-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); }

/* impersonation banner */
.impersonate-banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  background: var(--purple-soft); border-bottom: 1px solid var(--purple-line); color: var(--purple);
  font-size: 12.5px; font-weight: 500;
}
.impersonate-banner svg { width: 16px; height: 16px; }
.impersonate-banner .btn { margin-left: auto; }

/* loading row helper */
.empty-state-pad { padding: 36px 20px; }

/* ============================================================
   MOBILE / PWA  — the professional app is used on phones,
   so these breakpoints make the core flows thumb-friendly.
   ============================================================ */

/* Dashboard status board: stack on phones so every status is visible without hidden swipe discovery. */
@media (max-width: 760px) {
  .status-cols {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    scroll-snap-type: none;
    gap: 12px;
    margin: 0;
    padding: 0;
  }
  .status-col { width: 100%; scroll-snap-align: unset; }
  .status-col-body { max-height: none; }
}

/* Detail layouts (cliente / tenant) stack */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .msg-grid { grid-template-columns: 1fr !important; }
  .msg-preview-col { order: -1; }   /* show WhatsApp preview above the editor on phones */
}

/* Mensagens 3-column editor */
@media (max-width: 1080px) and (min-width: 861px) {
  .msg-grid { grid-template-columns: 300px 1fr !important; }
  .msg-preview-col { grid-column: 1 / -1; }
}

/* Tip + progress card stacks */
@media (max-width: 760px) {
  .tip-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .tip-progress { margin-left: 0; min-width: 0; width: 100%; }
}

/* Filter bar: chips scroll horizontally instead of wrapping into tall stacks */
@media (max-width: 640px) {
  .filter-bar { gap: 10px; row-gap: 12px; }
  .filter-bar .search-wrap { max-width: none; flex: 1 1 100%; }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -14px; padding: 0 14px 2px; gap: 7px;
  }
  .chips::-webkit-scrollbar { height: 0; }
  .chip {
    flex: none;
    min-height: 40px;
    padding-inline: 12px;
    font-size: 12.5px;
  }
  .chip .c-count { font-size: 11px; }
  .mc-link { display: inline-flex; align-items: center; min-height: 46px; }
  .var-chip { min-height: 46px; padding-top: 8px; padding-bottom: 8px; }
  .filter-bar > div[style*="margin-left:auto"] { margin-left: 0 !important; width: 100%; }
  .empty {
    min-height: 46dvh;
    padding: 32px 18px;
  }
}

/* ---- Responsive tables → cards (.r-cards) ---- */
@media (max-width: 680px) {
  .r-cards thead { display: none; }
  .r-cards, .r-cards tbody { display: block; width: 100%; }
  .table-wrap:has(.r-cards) {
    overflow: visible;
  }
  .table-wrap .r-cards tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }
  .r-cards tbody tr {
    display: block; width: 100%;
    background: color-mix(in oklch, var(--surface-2) 82%, var(--surface));
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    margin-bottom: 0;
    padding: 12px 14px;
  }
  .r-cards tbody tr:hover { background: var(--surface-2); }
  .r-cards tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    align-items: baseline;
    gap: 10px;
    padding: 6px 0 !important;
    border: none !important;
    text-align: right;
    min-width: 0;
    line-height: 1.25;
  }
  .r-cards tbody td::before {
    content: attr(data-label);
    min-width: 0;
    text-align: left;
    color: var(--text-faint); font-size: 10.5px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
  }
  /* the name/title cell becomes the card header */
  .r-cards td.r-head {
    display: block;
    padding: 0 0 10px !important; margin-bottom: 5px;
    border-bottom: 1px solid var(--border-soft) !important;
    text-align: left;
  }
  .r-cards td.r-head::before { display: none; }
  .r-cards td.r-head .cli-row-name { width: 100%; }
  .r-cards td.r-head .cli-row-name > div:last-child { min-width: 0; }
  .r-cards td.r-head a { display: inline-flex; align-items: center; min-height: 46px; }
  /* actions row spans full width */
  .r-cards td.r-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px !important;
    margin-top: 4px;
    border-top: 1px solid var(--border-soft) !important;
  }
  .r-cards td.r-actions::before { display: none; }
  .r-cards td.r-actions > .row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    align-items: center;
    justify-content: stretch !important;
    gap: 8px;
  }
  .r-cards td.r-actions .btn,
  .r-cards td.r-actions .btn-whatsapp {
    width: 100% !important;
    min-width: 0;
  }
  .r-cards td.r-actions .btn-icon,
  .r-cards td.r-actions .ico-btn {
    width: 46px;
    min-width: 46px;
  }
  .r-cards td.r-actions > .btn-icon,
  .r-cards td.r-actions > .ico-btn {
    flex: 0 0 46px;
  }
  .r-cards .td-right { text-align: right; }

  .r-cards tbody tr[data-entity="cliente"] {
    position: relative;
    padding-top: 16px;
  }
  .r-cards tbody tr[data-entity="cliente"] td.client-status-cell {
    align-items: center;
  }
  .r-cards tbody tr[data-entity="cliente"] td.client-status-cell .status-pill {
    justify-self: end;
    text-align: right;
  }
  .r-cards td.client-actions-cell {
    border-top: 1px solid var(--border-soft) !important;
    padding-top: 12px !important;
  }
  .r-cards td.client-actions-cell .client-card-actions {
    width: 100%;
    display: block;
  }
  .r-cards td.client-actions-cell .client-card-menu {
    position: absolute !important;
    top: 12px;
    right: 12px;
    z-index: 2;
  }
  .r-cards td.client-actions-cell .client-card-menu .ico-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }
  .r-cards td.client-actions-cell .btn-whatsapp {
    width: 100% !important;
  }
  .r-cards tbody tr[data-entity="cliente"] td.r-head {
    padding-right: 48px !important;
  }
}

/* ---- Public / marketing pages ---- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 44px 0 36px; }
  .hero h1 { font-size: 34px; }
  .hero p.lede { font-size: 15.5px; }
  .feat-grid, .steps-grid { grid-template-columns: 1fr 1fr !important; }
  .price-grid { grid-template-columns: 1fr !important; max-width: 460px; margin-left: auto; margin-right: auto; }
  .price-card.featured { order: -1; }
  .seg-card-grid { grid-template-columns: 1fr 1fr !important; }
  .section { padding: 44px 0; }
  .section h2 { font-size: 26px; }
  .cta-band { padding: 40px 20px; }
  .cta-band h2 { font-size: 23px; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 28px; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .feat-grid, .steps-grid, .seg-card-grid { grid-template-columns: 1fr !important; }
  .hero-trust { gap: 12px; }
  .hero-shot .grid { grid-template-columns: 1fr !important; }
}

/* ---- Onboarding ---- */
@media (max-width: 640px) {
  .onb-wrap { padding: 24px 16px 90px; }
  .onb-steps { gap: 0; }
  .onb-step .lbl { display: none; }     /* keep just the numbered dots + connectors */
  .onb-step:not(:last-child) { flex: 1; }
  .seg-card-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ---- Misc tightening on phones ---- */
@media (max-width: 640px) {
  .panel-head { padding: 13px 14px; }
  .panel-pad { padding: 15px; }
  .metric { padding: 15px; }
  .metric-value { font-size: 26px; }
  .profile-head { padding: 20px 16px; }
  .wa-preview .wa-body { min-height: 180px; }
  .impersonate-banner { flex-wrap: wrap; }
  .impersonate-banner .btn { margin-left: 0; width: 100%; }
  .tabs {
    margin-inline: -14px;
    padding-inline: 14px;
  }
  .tabs button {
    flex: 0 0 auto;
    padding-inline: 12px;
  }
  .mobile-form-actions { margin-top: 2px !important; }

  .campaign-client-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .campaign-client-tools .search-wrap {
    max-width: none !important;
    width: 100%;
  }
  .campaign-client-tools > .field {
    min-width: 0 !important;
    width: 100%;
  }
  .campaign-client-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 8px;
  }
  .campaign-client-actions .btn {
    width: 100%;
    min-width: 0;
  }
  .campaign-modal-foot {
    display: grid !important;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr);
    width: 100%;
  }
  .campaign-modal-foot .btn {
    width: 100%;
    font-size: 13px;
  }
  .client-picker-row {
    padding: 10px 12px !important;
    gap: 10px;
  }
  .client-picker-row .status-pill {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ============================================================
   RESPONSIVE HARDENING
   Page-level overrides for dense dashboards, campaign flows and
   public pages that still carry inline prototype grid styles.
   ============================================================ */

.cli-name,
.tmpl-h4,
.tmpl-p,
.flag-name,
.info-row .iv,
.stat-line .sl-val,
.mini-card .mc-val {
  overflow-wrap: anywhere;
}

.campaign-detail-stats,
.campaign-metrics,
.campaign-participants,
.campaign-actions {
  min-width: 0;
}

@media (max-width: 760px) {
  .row-between {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .stat-line {
    align-items: flex-start;
    gap: 12px;
  }
  .stat-line .sl-label {
    min-width: 0;
    flex: 1;
  }
  .stat-line .sl-val {
    text-align: right;
  }
  .info-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .info-row .iv {
    margin-left: 28px;
    flex: 1 1 calc(100% - 28px);
    text-align: left;
  }
  .donut-wrap {
    width: 100%;
  }
  .chart-bars {
    gap: 7px;
    overflow-x: auto;
    min-width: 0;
    padding-bottom: 2px;
  }
  .chart-bars .bar {
    min-width: 36px;
  }
  .tmpl-item {
    align-items: flex-start;
  }
  .tmpl-item p,
  .tmpl-p {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .cli-card-top,
  .health-big,
  .mini-card .mc-head,
  .risk-row {
    align-items: flex-start;
  }
  .cli-card-top {
    flex-wrap: wrap;
  }
  .status-col { width: 100%; }
  .seg-card {
    padding: 16px 12px;
  }
  .seg-card .sc-ico {
    width: 42px;
    height: 42px;
  }
  .hero {
    min-width: 0;
  }
  .hero h1,
  .section h2,
  .cta-band h2 {
    overflow-wrap: anywhere;
  }
  .hero-shot {
    border-radius: var(--radius);
  }
  .public-footer {
    margin-top: 44px;
    padding: 30px 16px;
  }
}

@media (max-width: 460px) {
  .grid-4 {
    grid-template-columns: 1fr !important;
  }
  .profile-stat-row {
    grid-template-columns: 1fr;
  }
  .page-head-actions > *,
  .filter-bar .search-wrap,
  .filter-bar > .select,
  .filter-bar > .btn,
  .filter-bar > .segmented {
    flex-basis: 100%;
    width: 100%;
    max-width: none !important;
  }
  .page-head-actions .segmented button,
  .filter-bar .segmented button {
    flex: 1 1 0;
    min-height: 46px;
  }
  .r-cards tbody td {
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    gap: 8px;
  }
  .r-cards tbody td::before { max-width: none; }
  .r-cards td.r-actions > .row {
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 8px;
  }
  .r-cards td.r-actions .btn-icon,
  .r-cards td.r-actions .ico-btn {
    width: 46px;
    min-width: 46px;
  }
  .modal-overlay {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal {
    border-left: 0;
    border-right: 0;
  }
}

@media (display-mode: standalone) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 34px 0 28px;
  }
  .hero h1 {
    font-size: 29px;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }
  .hero p.lede {
    max-width: none;
    font-size: 15px;
  }
  .hero-cta {
    flex-direction: column;
  }
  .hero-cta .btn {
    width: 100%;
  }
  .hero-trust {
    gap: 12px;
  }
  .hero-shot {
    border-radius: var(--radius);
  }
  .hero-shot .grid,
  .feat-grid,
  .steps-grid,
  .price-grid,
  .seg-card-grid,
  .status-cols,
  .detail-grid,
  .msg-grid {
    grid-template-columns: 1fr !important;
  }
  .section {
    padding: 40px 0;
  }
  .section h2 {
    font-size: 25px;
    overflow-wrap: anywhere;
  }
  .section .section-sub {
    font-size: 14px;
  }
  .cta-band {
    padding: 34px 18px;
  }
  .cta-band h2 {
    font-size: 23px;
  }
  .onb-wrap {
    padding: 24px 16px 90px;
  }
  .onb-step .lbl {
    display: none;
  }
  .onb-step:not(:last-child) {
    flex: 1;
  }
  .status-col {
    width: 100%;
  }
  .status-col-body {
    max-height: none;
  }
  .page-head {
    align-items: flex-start;
    margin-bottom: 18px;
  }
  .page-head h1 {
    font-size: 21px;
  }
  .page-head-actions,
  .filter-bar {
    width: 100%;
  }
  .page-head-actions > *,
  .filter-bar .search-wrap,
  .filter-bar > .select,
  .filter-bar > .btn,
  .filter-bar > .segmented {
    flex-basis: 100%;
    width: 100%;
    max-width: none !important;
  }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -14px;
    padding: 0 14px 2px;
  }
  .chips::-webkit-scrollbar { height: 0; }
  .chip {
    flex: none;
    min-height: 40px;
  }
  .donut-wrap,
  .tip-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .tip-progress {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
}

html.is-mobile-pwa .hero {
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 34px 0 28px;
}
html.is-mobile-pwa .hero h1 {
  font-size: 29px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
html.is-mobile-pwa .hero p.lede {
  max-width: none;
  font-size: 15px;
}
html.is-mobile-pwa .hero-cta {
  flex-direction: column;
}
html.is-mobile-pwa .hero-cta .btn {
  width: 100%;
}
html.is-mobile-pwa .hero-trust {
  gap: 12px;
}
html.is-mobile-pwa .hero-shot {
  border-radius: var(--radius);
}
html.is-mobile-pwa .hero-shot .grid,
html.is-mobile-pwa .feat-grid,
html.is-mobile-pwa .steps-grid,
html.is-mobile-pwa .price-grid,
html.is-mobile-pwa .seg-card-grid,
html.is-mobile-pwa .status-cols,
html.is-mobile-pwa .detail-grid,
html.is-mobile-pwa .msg-grid {
  grid-template-columns: 1fr !important;
}
html.is-mobile-pwa .section {
  padding: 40px 0;
}
html.is-mobile-pwa .section h2 {
  font-size: 25px;
  overflow-wrap: anywhere;
}
html.is-mobile-pwa .section .section-sub {
  font-size: 14px;
}
html.is-mobile-pwa .cta-band {
  padding: 34px 18px;
}
html.is-mobile-pwa .cta-band h2 {
  font-size: 23px;
}
html.is-mobile-pwa .onb-wrap {
  padding: 24px 16px 90px;
}
html.is-mobile-pwa .onb-step .lbl {
  display: none;
}
html.is-mobile-pwa .onb-step:not(:last-child) {
  flex: 1;
}
html.is-mobile-pwa .status-col {
  width: 100%;
}
html.is-mobile-pwa .status-col-body {
  max-height: none;
}
html.is-mobile-pwa .page-head {
  align-items: flex-start;
  margin-bottom: 18px;
}
html.is-mobile-pwa .page-head h1 {
  font-size: 21px;
}
html.is-mobile-pwa .page-head-actions,
html.is-mobile-pwa .filter-bar {
  width: 100%;
}
html.is-mobile-pwa .page-head-actions > *,
html.is-mobile-pwa .filter-bar .search-wrap,
html.is-mobile-pwa .filter-bar > .select,
html.is-mobile-pwa .filter-bar > .btn,
html.is-mobile-pwa .filter-bar > .segmented {
  flex-basis: 100%;
  width: 100%;
  max-width: none !important;
}
html.is-mobile-pwa .chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -14px;
  padding: 0 14px 2px;
}
html.is-mobile-pwa .chips::-webkit-scrollbar { height: 0; }
html.is-mobile-pwa .chip {
  flex: none;
  min-height: 40px;
}
html.is-mobile-pwa .donut-wrap,
html.is-mobile-pwa .tip-card {
  flex-direction: column;
  align-items: flex-start;
}
html.is-mobile-pwa .tip-progress {
  width: 100%;
  min-width: 0;
  margin-left: 0;
}
