/* Base visual dos dois apps. Cada app define as cores em :root no próprio styles.css. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--acc); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.82rem; }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 12px; align-content: start; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Botões */
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 0.9rem; transition: background .12s, border-color .12s, transform .06s; }
button:hover { background: var(--surface-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--acc-fill); border-color: var(--acc-fill); color: var(--on-acc); }
button.primary:hover { filter: brightness(1.05); background: var(--acc-fill); }
button.danger { color: var(--late); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.link { background: none; border: 0; padding: 0; color: var(--acc); font-weight: 600; }
button.block { width: 100%; }
button.sm { padding: 5px 10px; font-size: 0.8rem; }
.icon-btn { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; }
.icon-btn:hover { background: var(--surface-2); }

/* Formulários */
.field { display: grid; gap: 4px; min-width: 0; }
.field-l { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 11px; font-size: 16px; min-width: 0; }
@media (min-width: 900px) { input, select, textarea { font-size: 0.92rem; } }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc-fill); }
.hint { color: var(--ink-2); font-size: 0.76rem; }
.form-err { color: var(--late); font-size: 0.86rem; min-height: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* Cartões e etiquetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; overflow-wrap: break-word; }
.card > *, .list > * { min-width: 0; }
.card h3 small { font-family: var(--f-mono); font-weight: 500; font-size: 0.72rem; color: var(--ink-2); margin-left: 6px; }
.eyebrow { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-mono); font-size: 0.7rem; padding: 1px 7px; border-radius: 5px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.soon { background: var(--warn-soft); color: var(--warn); }
.pill.late { background: var(--late-soft); color: var(--late); }
.pill.acc { background: var(--acc-soft); color: var(--acc); }
.av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-family: var(--f-mono); font-size: 0.66rem; font-weight: 500; background: var(--acc-soft); color: var(--acc); flex: none; }
.empty { text-align: center; color: var(--ink-2); padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--r); display: grid; gap: 10px; justify-items: center; }
.bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--acc-fill); max-width: 100%; }
.bar.warn > i { background: var(--warn); } .bar.late > i { background: var(--late); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.88rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.list { display: grid; }
.list > * { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* Tabelas */
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th { text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Gaveta e camadas */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 10, .38); z-index: 65; display: flex; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.scrim.in { opacity: 1; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--paper); display: grid; grid-template-rows: auto 1fr; box-shadow: -8px 0 30px rgba(0,0,0,.18); transform: translateX(24px); transition: transform .18s ease-out; }
.drawer.wide { width: min(860px, 100%); }
.scrim.in .drawer { transform: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); padding-top: max(14px, env(safe-area-inset-top)); }
.drawer-b { overflow-y: auto; padding: 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); display: grid; gap: 16px; align-content: start; }
@media (prefers-reduced-motion: reduce) { .scrim, .drawer { transition: none; } }

.toasts { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 10px; padding: 10px 14px; font-size: 0.88rem; display: flex; justify-content: space-between; gap: 12px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: pop .16s ease-out; }
.toast.bad { background: var(--late); color: #fff; }
.toast .link { color: var(--acc-fill); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand h1 { font-size: 1.7rem; }
.clap-mark { width: 34px; height: 28px; border-radius: 5px; border: 3px solid var(--acc-fill); position: relative; flex: none; }
.clap-mark::before { content: ""; position: absolute; left: -3px; right: -3px; top: -10px; height: 8px; border-radius: 3px 3px 0 0; background: repeating-linear-gradient(-45deg, var(--acc-fill) 0 5px, var(--ink) 5px 10px); }

/* Esqueleto do app: cabeçalho de vidro + conteúdo + Dock flutuante */
.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: 10px clamp(14px, 3vw, 32px); padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--paper) 78%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); min-height: 60px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.topbar .brand .clap-mark { width: 26px; height: 22px; border-width: 2.5px; }
.topbar .brand .clap-mark::before { top: -8px; height: 6px; }
.topbar .page-title { font-family: var(--f-display); font-size: 1.05rem; font-weight: 700; color: var(--ink-2); border-left: 1px solid var(--line); padding-left: 12px; }
.topbar .spacer { flex: 1; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 0.7rem; color: var(--ok); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: live 2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.page { width: 100%; max-width: 1560px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 32px) calc(130px + env(safe-area-inset-bottom)); display: grid; gap: 18px; align-content: start; min-width: 0; }
.content { display: grid; gap: 18px; align-content: start; min-width: 0; }
@media (max-width: 640px) { .topbar .page-title { display: none; } .hide-sm { display: none !important; } }

/* Dock */
.dock { position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 45; display: flex; justify-content: center; padding: 0 8px; pointer-events: none; }
.dock-bar { pointer-events: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  padding: 8px 12px 4px; border-radius: 26px; border: 1px solid color-mix(in srgb, #fff 35%, transparent);
  background: color-mix(in srgb, var(--surface) 62%, transparent); backdrop-filter: saturate(1.6) blur(24px); -webkit-backdrop-filter: saturate(1.6) blur(24px);
  box-shadow: 0 14px 44px -12px rgba(0, 0, 0, .45), inset 0 1px 0 color-mix(in srgb, #fff 25%, transparent); }
.dock-bar::-webkit-scrollbar { display: none; }
@media (pointer: fine) and (min-width: 900px) { .dock-bar { overflow: visible; } }
.dock-side { display: flex; align-items: flex-end; gap: 8px; }
.dock-side.left { justify-content: flex-end; } .dock-side.right { justify-content: flex-start; } .dock-side.mid { padding: 0 4px; }
.dock-item { --size: 46px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-decoration: none; flex: none; width: max(58px, var(--size)); }
.dock-item.center { --size: 58px; }
.dock-tile { width: var(--size); height: var(--size); border-radius: 28%; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .35); transition: width .14s ease-out, height .14s ease-out, transform .18s; }
.dock-tile svg { width: 50%; height: 50%; stroke-width: 2.1; }
.dock-item.center .dock-tile { box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .55), 0 0 0 2px rgba(255, 255, 255, .7); }
.dock-item:active .dock-tile { transform: scale(.92); }
.dock-label { margin-top: 3px; font-size: 10px; line-height: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dock-item.on .dock-label { color: var(--ink); font-weight: 800; }
.dock-dot { width: 4px; height: 4px; border-radius: 50%; margin-top: 2px; background: transparent; }
.dock-item.on .dock-dot { background: var(--ink); }
.dock-tip { position: absolute; top: -30px; padding: 3px 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip { opacity: 1; }
.dock-badge { position: absolute; top: -3px; right: calc(50% - var(--size) / 2 - 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.dock-sep { width: 1px; height: 40px; margin: 0 4px 16px; background: color-mix(in srgb, var(--ink) 18%, transparent); align-self: flex-end; }
@media (max-width: 640px) { .dock-item { --size: 40px; width: 52px; } .dock-item.center { --size: 50px; } .dock-label { font-size: 9px; } .dock-bar { border-radius: 22px; padding: 6px 8px 3px; gap: 4px; } .dock-side { gap: 4px; } }
@media (max-width: 480px) { .dock { padding: 0 6px; } .dock-bar { width: 100%; padding: 6px 6px 5px; gap: 2px; border-radius: 22px; } .dock-side { gap: 2px; } .dock-item { --size: 34px; width: 36px; } .dock-item.center { --size: 42px; width: 46px; } .dock-label { display: none; } .dock-dot { margin-top: 3px; } .dock-sep { height: 26px; margin: 0 2px 9px; } .dock-badge { min-width: 16px; height: 16px; font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { .dock-tile { transition: none; } .live-dot::before { animation: none; } }

/* Conectar WhatsApp (os dois apps) */
.wa-card { gap: 14px; }
.wa-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.wa-head h3 { font-size: 1.05rem; }
.wa-tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #8A9A93, #5E6B66); }
.wa-tile.on { background: linear-gradient(135deg, #25D366, #128C4A); box-shadow: 0 8px 20px -10px rgba(18, 140, 74, .8); }
.wa-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.wa-pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.wa-pill.ok { background: var(--ok-soft); color: var(--ok); } .wa-pill.ok i { animation: live 2s infinite; }
.wa-pill.warn { background: var(--warn-soft); color: var(--warn); }
.wa-pill.late { background: var(--late-soft); color: var(--late); }
.wa-start { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px; border-radius: 16px; background: var(--surface-2); }
.wa-phone { width: 92px; height: 132px; border-radius: 20px; border: 3px solid var(--ink); display: grid; place-items: center; background: var(--surface); position: relative; }
.wa-phone::before { content: ""; position: absolute; top: 6px; width: 26px; height: 4px; border-radius: 99px; background: var(--ink); }
.wa-phone span { color: var(--ink); }
.wa-ok { display: grid; gap: 12px; }
.wa-num { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--ok-soft); }
.wa-num b { display: block; font-family: var(--f-display); font-size: 1.25rem; }
.wa-num small { color: var(--ink-2); }
.wa-check { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #25D366; color: #fff; flex: none; }
.wa-check.big { width: 84px; height: 84px; animation: pop .3s ease-out; }
.wa-hook { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line); font-size: .84rem; }
.wa-hook > svg { margin-top: 2px; color: var(--ink-2); }
.wa-hook.ok > svg { color: var(--ok); } .wa-hook.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); } .wa-hook.warn > svg { color: var(--warn); }
.wa-hook small { display: block; color: var(--ink-2); }
.wa-hook code { display: block; margin-top: 4px; font-family: var(--f-mono); font-size: .72rem; color: var(--ink-2); word-break: break-all; }
.wa-explain { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.wa-explain svg { color: var(--acc); margin-top: 2px; }
.wa-connect { display: grid; gap: 16px; }
.wa-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: start; }
.wa-qrcol { display: grid; gap: 8px; justify-items: center; }
.wa-qr { width: 280px; height: 280px; border-radius: 18px; background: #fff; padding: 14px; display: grid; place-items: center; box-shadow: 0 12px 36px -18px rgba(0, 0, 0, .55); border: 1px solid var(--line); }
.wa-qr img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.wa-qr.loading { gap: 10px; align-content: center; color: #555; text-align: center; }
.wa-qr.loading.small { width: 100%; height: 120px; }
.wa-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #25D366; border-right-color: transparent; animation: wa-rot .8s linear infinite; }
@keyframes wa-rot { to { transform: rotate(360deg); } }
.wa-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.wa-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; }
.wa-steps li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #25D366; color: #fff; font-weight: 800; font-size: .82rem; }
.wa-steps li p { padding-top: 3px; }
.wa-code { display: grid; gap: 6px; justify-items: center; padding: 18px; border-radius: 16px; background: var(--surface-2); }
.wa-code b { font-family: var(--f-mono); font-size: 2.2rem; letter-spacing: .18em; }
.wa-done { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 30px 10px; }
@media (max-width: 720px) { .wa-grid { grid-template-columns: minmax(0, 1fr); } .wa-qr { width: min(280px, 80vw); height: min(280px, 80vw); } .wa-start { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .wa-start .row { justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .wa-spin, .wa-pill.ok i { animation: none; } }
.wa-card .field { align-content: start; }
