/* Jescri — tema neutro com acento roxo (AI-Native UI). Mobile-first. */
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;
  --ink: #18181B;
  --muted: #52525B;
  --line: #E4E4E7;
  --primary: #7C3AED;
  --primary-ink: #FFFFFF;
  --primary-hover: #6D28D9;
  --primary-soft: #F3EEFF;
  --primary-text: #6D28D9;
  --wa: #15803D;
  --wa-hover: #166534;
  --bubble: #E8F5E9;
  --bubble-ink: #14301c;
  --ok: #15803D;
  --warn: #B45309;
  --danger: #B91C1C;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(24,24,27,.05), 0 8px 24px rgba(24,24,27,.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}
:root[data-theme="dark"] {
  --bg: #0D0D10;
  --surface: #16161A;
  --surface-2: #1F1F25;
  --ink: #F4F4F5;
  --muted: #A1A1AA;
  --line: #2A2A31;
  --primary: #7C3AED;
  --primary-hover: #8B5CF6;
  --primary-soft: #231A3D;
  --primary-text: #C4B5FD;
  --wa: #16A34A;
  --wa-hover: #22C55E;
  --bubble: #12301D;
  --bubble-ink: #DDF5E3;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --danger: #F87171;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.12; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary-text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease), color .18s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-text); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .88rem; }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--primary-text); text-decoration: underline; font-size: .88rem; min-height: 40px; }

/* ---------- formulários ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: .88rem; font-weight: 600; }
.input, textarea, select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
textarea { min-height: 200px; resize: vertical; line-height: 1.5; }
.input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { color: var(--muted); font-size: .86rem; }
.err { color: var(--danger); font-size: .9rem; min-height: 1.3em; }

/* ---------- cartões, selos ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.badge.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.busy { background: var(--primary-soft); color: var(--primary-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.busy .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .4s var(--ease); }

/* ---------- topo (app e landing) ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.spacer { flex: 1; }
.who { display: none; font-size: .88rem; color: var(--muted); }
@media (min-width: 640px) { .who { display: inline; } }

/* ---------- diálogo ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 22px; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px); overflow: auto; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(10,10,14,.55); }
dialog h2 { font-size: 1.35rem; margin-bottom: 12px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- balão de WhatsApp ---------- */
.bubble {
  background: var(--bubble); color: var(--bubble-ink); border-radius: 14px 14px 14px 4px;
  padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.5;
}

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: .92rem; font-weight: 500;
  z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* marca: "Jescri Loja da Renda - Gerenciador de Contato" */
.brand { min-width: 0; }
.btxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.bname { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsub { font-weight: 500; font-size: .74rem; color: var(--muted); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) {
  .btxt { flex-direction: row; align-items: baseline; gap: 0; }
  .bsub { font-size: 1.02rem; font-weight: 600; }
  .bsub::before { content: " - "; white-space: pre; }
}
@media (max-width: 759px) { .section { display: none !important; } }
