:root {
  --purple: #6C4CF0;
  --purple2: #7B5CFA;
  --teal: #0BD9C5;
  --ink: #14141a;
  --mut: #6c6c78;
  --line: #eceef3;
  --red: #E0244B;
  --amber: #A0700C;
  --green: #19a974;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; color: var(--ink);
  background: radial-gradient(1200px 600px at 15% -10%, rgba(108,76,240,.10), transparent),
              radial-gradient(1000px 600px at 100% 0%, rgba(11,217,197,.10), transparent),
              #F5F6F8;
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.hidden { display: none !important; }
/* ---------- app: coluna de altura fixa; SO' .rolagem rola (nada de position:fixed) ----------
   iOS/PWA descola elementos fixed depois do teclado ou no fim da rolagem (16/09: barra de
   acoes e toast no meio da tela). Com o scroll DENTRO de um filho, a barra e' um item normal
   do flex e o toast/overlay sao absolute dentro do container — nunca saem do lugar. */
#tela-app { height: 100%; height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.rolagem { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px 16px 28px; }

/* ---------- login ---------- */
.tela-login { height: 100%; height: 100dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); gap: 18px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 20px; padding: 32px 26px 28px; box-shadow: 0 20px 50px rgba(20,20,26,.10); text-align: center; }
.logo { width: 120px; height: auto; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: -.02em; }
.sub { color: var(--mut); font-size: 13px; margin: 0 0 22px; line-height: 1.4; }
.campo { text-align: left; margin-bottom: 14px; }
.campo label { display: block; font-size: 11px; font-weight: 700; color: var(--mut); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.campo input, .chat-box input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px; font-family: inherit; background: #fff; color: var(--ink); }
.campo input:focus, .chat-box input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(108,76,240,.12); }
.erro { margin: 12px 0 0; color: var(--red); font-size: 12.5px; font-weight: 600; min-height: 1em; }
.link-esqueci { display: inline-block; margin-top: 14px; color: var(--purple); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.rodape { color: var(--mut); font-size: 11px; margin: 0; }

/* ---------- insight da IA (17/09) ---------- */
.secao.insight { border-color: rgba(108,76,240,.35); background: linear-gradient(180deg, rgba(108,76,240,.07), #fff 70%); }
.secao.insight h2 small { font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--mut); margin-left: 6px; }
.insight-txt { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; color: var(--ink); }
/* fixar pelo celular (17/09) */
.item .fixar { flex-shrink: 0; align-self: center; border: 0; border-radius: 9px; padding: 8px 10px; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit; background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.item .fixar:active { transform: scale(.96); }
.item.fixado { border-color: rgba(108,76,240,.45); background: rgba(108,76,240,.06); }
.item .fixado-tag { flex-shrink: 0; align-self: center; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--purple); }

/* ---------- suporte (WhatsApp) ---------- */
.btn-zap { display: block; text-align: center; text-decoration: none; border-radius: 12px; padding: 13px 16px; font-size: 14px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #25D366, #128C7E); box-shadow: 0 8px 20px rgba(37,211,102,.25); }
.btn-zap:active { transform: scale(.97); }
.link-zap { margin-left: 14px; color: #128C7E; }

/* ---------- botoes ---------- */
.btn { border: 0; border-radius: 12px; padding: 14px 16px; font-size: 14px; font-weight: 800; cursor: pointer; font-family: inherit; transition: transform .1s, filter .1s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; }
.btn.primary { width: 100%; background: linear-gradient(135deg, var(--purple), var(--teal)); color: #fff; box-shadow: 0 8px 20px rgba(108,76,240,.25); }
.btn.primary.sm { width: auto; padding: 12px 16px; font-size: 13px; }
.btn.perigo { background: linear-gradient(135deg, #FF5C7A, var(--red)); color: #fff; box-shadow: 0 8px 20px rgba(224,36,75,.25); }
.btn.aviso { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.mini { padding: 8px 12px; font-size: 12px; border-radius: 9px; background: #fff; color: var(--ink); border: 1.5px solid rgba(0,0,0,.08); align-self: flex-start; }
.link { background: none; border: 0; color: var(--mut); font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; padding: 6px 8px; }

/* ---------- header ---------- */
header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-tt { font-weight: 800; font-size: 14px; }
.status-sub { color: var(--mut); font-size: 11.5px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #c7c7d1; flex-shrink: 0; }
.dot.live { background: var(--red); box-shadow: 0 0 0 4px rgba(224,36,75,.18); animation: pulso 1.6s infinite; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(224,36,75,.35); } 70% { box-shadow: 0 0 0 8px rgba(224,36,75,0); } 100% { box-shadow: 0 0 0 0 rgba(224,36,75,0); } }

/* ---------- hero ---------- */
.hero { display: flex; justify-content: center; margin: 6px 0 16px; }
.hero-ring { width: 230px; height: 230px; border-radius: 50%; padding: 6px; background: conic-gradient(var(--purple), var(--teal), var(--purple)); box-shadow: 0 16px 40px rgba(108,76,240,.22); }
.hero-inner { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.hero-label { font-size: 10.5px; font-weight: 800; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; }
.hero-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.hero-sub { font-size: 14px; font-weight: 700; color: var(--purple); font-variant-numeric: tabular-nums; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: 0 4px 14px rgba(20,20,26,.04); }
.stat-ico { font-size: 16px; }
.stat-v { font-size: 17px; font-weight: 800; }
.stat-k { font-size: 9.5px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; text-align: center; }

/* ---------- banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.banner-ico { font-size: 18px; line-height: 1.2; }
.banner-col { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.banner.alerta { background: #fdeceb; border: 1px solid #f6c9c5; color: #b3261e; }
.banner.aviso { background: #fff7e6; border: 1px solid #f5dfb1; color: var(--amber); }

/* ---------- secoes / listas ---------- */
.secao { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: 0 4px 14px rgba(20,20,26,.04); }
.secao h2 { margin: 0 0 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.lista { display: flex; flex-direction: column; gap: 6px; }
.vazio { color: var(--mut); font-size: 12.5px; margin: 4px 0; }
.item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 11px; background: #fbfbfd; border: 1px solid var(--line); font-size: 13px; }
.item.venda { border-color: rgba(25,169,116,.35); background: rgba(25,169,116,.06); }
.item-l, .item-r { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-r { align-items: flex-end; text-align: right; flex-shrink: 0; }
.item b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item span { color: var(--mut); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.chat-box { display: flex; gap: 8px; }
.chat-box input { font-size: 15px; padding: 12px 13px; }
.dica { color: var(--mut); font-size: 11px; margin: 8px 0 0; }
.secao-cfg .chk { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.secao-cfg input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--purple); }

/* ---------- onboarding: instalar como app + permissoes ---------- */
.secao.onb { border-color: rgba(108,76,240,.35); background: linear-gradient(180deg, rgba(108,76,240,.07), #fff 65%); }
.secao.onb h2 { color: var(--ink); text-transform: none; letter-spacing: -.01em; font-size: 15px; }
.onb-passos { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.onb-passos li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; }
.onb-n { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--teal)); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.onb-acoes { display: flex; align-items: center; gap: 10px; }

/* ---------- barra de acoes fixa ---------- */
.acoes { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(245,246,248,.96); border-top: 1px solid var(--line); }
.acoes .btn { flex: 1; padding: 13px 8px; font-size: 12.5px; }

/* ---------- overlay / toast ---------- */
.overlay { position: absolute; inset: 0; background: rgba(20,20,26,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.caixa { background: #fff; border-radius: 18px; padding: 22px 20px; max-width: 360px; width: 100%; box-shadow: 0 20px 50px rgba(20,20,26,.2); }
.caixa p { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; font-weight: 600; }
.caixa .row { display: flex; gap: 8px; }
.caixa .row .btn { flex: 1; }
.toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 700; z-index: 60; max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* ---------- controles (toggles) ---------- */
.ctl-lista { display: flex; flex-direction: column; }
.ctl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ctl:last-child { border-bottom: 0; }
.ctl span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctl b { font-size: 13.5px; font-weight: 800; }
.ctl small { color: var(--mut); font-size: 11px; }
.ctl input { display: none; }
.ctl i { flex-shrink: 0; width: 46px; height: 26px; border-radius: 13px; background: #d9d9e0; position: relative; transition: background .15s; }
.ctl i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.ctl input:checked + i { background: linear-gradient(135deg, #3DE86B, #17B24A); }
.ctl input:checked + i::after { left: 23px; }
.ctl.pendente i { opacity: .5; }
.ctl.indisponivel { opacity: .45; pointer-events: none; }

/* 18/09: vendas sem produto identificado (fecha a conta com o total oficial) */
.itens-sem { margin: 8px 2px 0; font-size: 12.5px; color: #5a5a66; font-style: italic; }
/* 19/09: a conta fechada fica no TOPO da lista (41 = 17 + 24), antes de rolar 20 itens */
.itens-conta { margin: 0 2px 10px; font-size: 12.5px; line-height: 1.45; color: #5a5a66; }
.itens-conta b { color: var(--ink); }
.link-insight { float: right; border: 0; background: none; color: var(--mut); font: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; padding: 0 2px; cursor: pointer; }

/* 24/09: sons do app das lojas e conta */
.som-linha{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:10px 0}
.som-linha label{flex:0 0 100%;font-size:14px;font-weight:600}
.som-linha select{flex:1;min-width:0;padding:8px;border-radius:10px;border:1px solid #e3e5ec;background:#fff;font:inherit;font-size:14px}
.conta-links{display:flex;flex-wrap:wrap;gap:14px;margin:6px 0 12px;font-size:13.5px}
.conta-links a{color:#5A3BD8;font-weight:600}
#excluir .campo{margin:10px 0 4px}
