/* Rubrica — componentes. Carregar por último:
   <link rel="stylesheet" href="/ds/tokens.css"><link rel="stylesheet" href="/ds/rubrica.css">
   Seções: base · menu lateral · cabeçalho de página · átomos · tabelas · estados · folha da assinatura
   · KPIs · mapa "quem recebe o quê" · listas · login · páginas editor/setores/banners · celular. */

/* ── Base ─────────────────────────────────────────────────────────────────── */
:root {
  /* nomes antigos usados por editor.css / setores.css / campanhas.css */
  --bg: var(--canvas); --ink-2: var(--ink-muted); --ink-3: var(--ink-subtle);
  --line: var(--hairline); --line-2: var(--surface-sunken);
  --accent-ink: var(--on-accent); --ok: var(--success); --ok-soft: var(--success-bg);
  --warn: var(--warning); --warn-soft: var(--warning-bg); --danger-soft: var(--danger-bg);
  --radius: var(--radius-lg); --mono: var(--font-mono);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); line-height: 1.15; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h2 { font-size: var(--text-lg); font-weight: 600; margin: 0; }
h3 { font-size: var(--text-md); font-weight: 600; margin: 0; }
.muted, .faint { color: var(--ink-subtle); }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.label { font-size: var(--text-xs); font-weight: 500; color: var(--ink-subtle); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Menu lateral ─────────────────────────────────────────────────────────── */
body.has-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
body.has-shell > .page { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.side {
  background: var(--sidebar); border-right: 1px solid var(--hairline); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; }
.side .brand svg { width: 28px; height: 28px; flex: none; }
.side .navgroup { font-size: var(--text-xs); color: var(--ink-subtle); padding: 10px 10px 4px; }
.side a.item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--radius-md);
  color: var(--ink-muted); text-decoration: none; font-weight: 500; white-space: nowrap; transition: background-color var(--motion), color var(--motion);
}
.side a.item svg { width: 18px; height: 18px; flex: none; }
.side a.item:hover { background: var(--surface-sunken); color: var(--ink); }
.side a.item[aria-current=page] { background: var(--surface); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent), 0 0 0 1px var(--hairline); }
.side a.item[aria-current=page] svg { color: var(--accent); }
.side .sep { height: 1px; background: var(--hairline); margin: 8px; flex: none; }
.side .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--hairline); font-size: var(--text-sm); }
.side .foot .who-text { min-width: 0; }
.side .foot .who-name { font-weight: 600; line-height: 1.2; }
.side .foot .who-mail { font-size: var(--text-xs); color: var(--ink-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.side .foot button { margin-left: auto; }

/* ── Cabeçalho de página ──────────────────────────────────────────────────── */
.main { padding: 28px clamp(16px, 3vw, 40px) 64px; width: 100%; max-width: 1320px; }
.main:focus { outline: none; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.phead p { margin: 6px 0 0; color: var(--ink-muted); max-width: 64ch; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Átomos ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-md); border: 1px solid var(--hairline); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color var(--motion), border-color var(--motion);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-muted); border-color: var(--hairline-strong); }
.btn.pri, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.pri:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.gho, .btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.gho:hover, .btn.ghost:hover { background: var(--accent-soft); }
.btn.dan, .btn.danger { color: var(--danger); }
.btn.dan:hover, .btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.sm { height: 32px; padding: 0 10px; font-size: var(--text-sm); }
.btn:disabled, .btn[aria-busy=true] { opacity: .55; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-muted);
}
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.on { background: var(--success-bg); color: var(--success); }
.chip.sch { background: var(--info-bg); color: var(--info); }
.chip.warn { background: var(--warning-bg); color: var(--warning); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.code { font-family: var(--font-mono); font-weight: 500; }

.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 18px; }
.card > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card > header p { margin: 2px 0 0; color: var(--ink-subtle); font-size: var(--text-sm); }
.tile { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink-muted); }
.tile svg { width: 18px; height: 18px; }
.av {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent);
}
.av img { width: 100%; height: 100%; object-fit: cover; }

.field { display: grid; gap: 6px; }
.field > span { font-size: var(--text-sm); font-weight: 500; color: var(--ink-muted); }
.field small { color: var(--ink-subtle); font-size: var(--text-xs); }
.inp, input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  height: 38px; width: 100%; border-radius: var(--radius-md); border: 1px solid var(--hairline-strong); background: var(--surface);
  padding: 0 10px; color: var(--ink);
}
textarea { height: auto; padding: 8px 10px; }
input[type=color] { padding: 3px; width: 56px; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--hairline-strong); background: var(--surface); }
input[readonly] { background: var(--surface-muted); color: var(--ink-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fgrid .full { grid-column: 1 / -1; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-md); background: var(--surface-sunken); border: 1px solid var(--hairline); gap: 2px; flex-wrap: wrap; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); font-weight: 500; cursor: pointer; }
.seg button[aria-pressed=true], .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hairline-strong); }

.tog { position: relative; flex: none; width: 40px; height: 24px; border-radius: var(--radius-pill); background: var(--hairline-strong); border: 0; cursor: pointer; transition: background-color var(--motion); }
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--motion); }
.tog[aria-checked=true] { background: var(--accent); }
.tog[aria-checked=true]::after { transform: translateX(16px); }
.togrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.togrow small { display: block; color: var(--ink-subtle); font-size: var(--text-sm); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 34px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--hairline-strong); background: var(--surface); cursor: pointer; font-weight: 500; font-size: var(--text-sm); display: inline-flex; align-items: center; gap: 6px; }
.pill[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.step { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step em { font-style: normal; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--hairline-strong); color: var(--ink-muted); font-size: 12px; font-weight: 600; font-family: var(--font-mono); }

/* ── Tabelas ──────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
.tbl th, table.people th { text-align: left; font-size: var(--text-xs); font-weight: 500; color: var(--ink-subtle); padding: 8px 10px; border-bottom: 1px solid var(--hairline); background: transparent; }
.tbl td, table.people td { padding: 10px; border-bottom: 1px solid var(--surface-sunken); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td, table.people tbody tr:hover td { background: var(--surface-muted); }
.tbl tr.sel td { background: var(--accent-soft); }
.who:not(td) { display: flex; align-items: center; gap: 10px; }
.who b { display: block; font-weight: 600; }
.who small { display: block; color: var(--ink-subtle); font-family: var(--font-mono); font-size: var(--text-xs); }
.scroll { overflow-x: auto; }

/* ── Estados ──────────────────────────────────────────────────────────────── */
.empty { display: grid; place-items: center; gap: 6px; text-align: center; padding: 32px 16px; color: var(--ink-subtle); }
.empty svg { width: 40px; height: 40px; color: var(--hairline-strong); }
.empty b { color: var(--ink); }
.alert { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--warning-bg); color: var(--warning); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.alert > span { flex: 1; }
.alert a { color: inherit; font-weight: 700; }
.alert svg { width: 18px; height: 18px; flex: none; }
.err { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-md); padding: 10px 12px; font-weight: 500; }
.err svg { width: 18px; height: 18px; flex: none; }
.note { font-size: var(--text-sm); color: var(--ink-muted); background: var(--surface-sunken); border-radius: var(--radius-md); padding: 12px; }
.note ol { margin: 6px 0 0; padding-left: 18px; }
.summary { background: var(--accent-soft); color: var(--ink); border-radius: var(--radius-md); padding: 10px 12px; font-weight: 500; margin: 12px 0 0; }
.dirty { font-size: var(--text-sm); color: var(--warning); font-weight: 600; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: var(--z-toast); font-weight: 500; max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

/* ── Folha da assinatura (prévia) ─────────────────────────────────────────── */
.desk { background: var(--surface-sunken); border-radius: var(--radius-lg); padding: clamp(10px, 2vw, 20px); }
.sheet { background: #fff; color: #222; border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 18px 20px; font: 13px/1.45 Arial, 'Segoe UI', sans-serif; overflow-x: auto; }
.sheet .mail { border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 14px; color: #555; }
.sheet iframe { width: 100%; border: 0; display: block; min-height: 60px; }
.kv td { overflow-wrap: anywhere; }

/* ── KPIs e grades ────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi .v { font-family: var(--font-mono); font-size: var(--text-kpi); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 8px 0 2px; }
.kpi .v.warn { color: var(--warning); }
.kpi small { color: var(--ink-subtle); }
.bar { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); margin: 8px 0 4px; overflow: hidden; }
.bar > b { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.g2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.stackc { display: grid; gap: 16px; align-content: start; }
.stackc > *, .g2 > *, .split > *, .desk, .sheet { min-width: 0; }
.kv td:first-child { color: var(--ink-subtle); width: 42%; }

/* ── Mapa "quem recebe o quê" ─────────────────────────────────────────────── */
.today { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.today h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; max-width: 46ch; line-height: 1.25; }
.today p { margin: 6px 0 0; color: var(--ink-muted); }

/* ── Listas de itens ──────────────────────────────────────────────────────── */
.blist { display: grid; gap: 8px; }
.bi { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--hairline); text-align: left; width: 100%; color: inherit; text-decoration: none; }
button.bi { cursor: pointer; }
button.bi:hover { border-color: var(--hairline-strong); }
.bi[aria-selected=true] { border-color: var(--accent); background: var(--accent-soft); }
.bi b { display: block; }
.bi small { color: var(--ink-subtle); font-size: var(--text-xs); }
.thumb { display: block; width: 100%; aspect-ratio: 3 / 1; border-radius: var(--radius-sm); background: var(--surface-sunken) center / cover no-repeat; border: 1px solid var(--hairline); }
.hist { display: grid; gap: 10px; font-size: var(--text-sm); }
.hist time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-subtle); }
pre.code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-sunken); padding: 12px; border-radius: var(--radius-md); overflow-x: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
textarea.code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; min-height: 340px; white-space: pre; tab-size: 2; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--canvas); }
.lbox { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 32px 28px; }
.lbox .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 20px; }
.lbox .brand svg { width: 44px; height: 44px; }
.sigdraw { display: block; margin: 14px 0 0; color: var(--accent); max-width: 100%; }
.sigdraw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s .2s cubic-bezier(.6, 0, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.modal { position: fixed; inset: 0; background: rgb(27 26 23 / .35); display: grid; place-items: center; padding: 16px; z-index: var(--z-modal); }
.modal > .card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-md); }

/* ── Páginas editor / setores / banners (HTML próprio, mesmo visual) ──────── */
body.has-shell .top {
  position: sticky; top: 0; z-index: var(--z-sticky); background: var(--canvas); color: var(--ink-muted);
  border-bottom: 1px solid var(--hairline); padding: 14px clamp(16px, 3vw, 32px); gap: 12px;
}
body.has-shell .top .back { display: none; }
body.has-shell .top .title b { color: var(--ink); font-family: var(--font-display); font-size: 22px; font-weight: 600; }
body.has-shell .top .title .faint { color: var(--ink-subtle); font-size: var(--text-sm); }
body.has-shell .top .title .faint.dirty { color: var(--warning); }
body.has-shell .top .inline span { color: var(--ink-subtle); }
body.has-shell .top select, body.has-shell .top input[type=text] { background: var(--surface); border-color: var(--hairline-strong); color: var(--ink); }
body.has-shell .top .btn { background: var(--surface); border-color: var(--hairline); color: var(--ink); }
body.has-shell .top .btn:hover { background: var(--surface-muted); }
body.has-shell .top .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
body.has-shell .top .btn.primary:hover { background: var(--accent-hover); }
.sx-list, .controls { background: var(--sidebar); border-right: 1px solid var(--hairline); }
.sx-list li button { border-radius: var(--radius-md); }
.sx-list li button.on { background: var(--accent-soft); border-color: var(--accent-line); }
.sx-main h1, #formTitle { font-family: var(--font-display); font-size: 24px; }
.sx-main .card { border-radius: var(--radius-lg); border-color: var(--hairline); }
.st { border-radius: var(--radius-sm); }
.st.on { background: var(--success-bg); color: var(--success); }
.st.wait { background: var(--info-bg); color: var(--info); }
.st.off { background: var(--surface-sunken); color: var(--ink-subtle); }
.sector-pick label { border-color: var(--hairline-strong); }
.sector-pick label.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.group, .group-head { border-color: var(--hairline); }
.group-head { background: var(--surface-muted); }
.group li label:hover { background: var(--surface-muted); }
.group li small, .people .who span { font-family: var(--font-mono); font-size: var(--text-xs); }
.img-box { border-color: var(--hairline-strong); background: var(--surface-muted); border-radius: var(--radius-md); }
.audience { background: var(--accent-soft); color: var(--ink); border-radius: var(--radius-md); font-weight: 500; }
.usage .chip { height: auto; padding: 4px 10px; }
.stage { background: var(--surface-sunken); }
.card h2 .stepn { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; border: 1px solid var(--hairline-strong); color: var(--ink-muted); font: 600 12px var(--font-mono); vertical-align: 1px; }

/* ── Movimento e celular ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sigdraw path { stroke-dashoffset: 0; }
}
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body.has-shell { display: block; }
  .side { position: sticky; top: 0; z-index: var(--z-rail); height: auto; flex-direction: row; align-items: center; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--hairline); overflow-x: auto; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side .brand { padding: 0 6px 0 2px; flex: none; }
  .side .brand span, .side .navgroup, .side .sep, .side .foot .who-text, .side .foot .av { display: none; }
  .side a.item { flex: none; height: 44px; }
  .side .foot { margin: 0; padding: 0 0 0 4px; border: 0; flex: none; }
  .btn { height: 44px; }
  .btn.sm { height: 40px; }
  .inp, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select { height: 44px; }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  body.has-shell .top { position: static; }
  h1 { font-size: 24px; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  table.stack thead { display: none; }
  table.stack tr { display: grid; padding-block: 10px; border-bottom: 1px solid var(--hairline); }
  table.stack td { display: flow-root; border: 0; padding: 3px 0 3px 7.5em; }
  table.stack td::before { content: attr(data-l); float: left; width: 7em; margin-left: -7.5em; font-size: var(--text-xs); color: var(--ink-subtle); }
  table.stack td:empty { display: none; }
}

/* ══ Identidade do protótipo (v3) ═══════════════════════════════════════════
   Verde neon do logo, Manrope, cantos generosos, rótulos em caixa alta, faixa escura no topo e login escuro.
   Fica no fim para valer sobre as regras acima e sobre o CSS das páginas avulsas. */
body { font: 15px/1.5 var(--font-sans); }
:focus-visible { outline-color: var(--signal); }
h1 { font-weight: 700; letter-spacing: -.01em; }
.label, .side .navgroup, th, .tbl th, .kpi .label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-subtle); }

/* menu */
.side .brand { font-weight: 700; font-size: 18px; }
.side a.item { height: 40px; border-radius: var(--radius-md); }
.side a.item:hover { background: var(--surface-sunken); }
.side a.item[aria-current=page] { background: var(--surface-sunken); box-shadow: inset 2px 0 0 var(--signal); }
.side a.item[aria-current=page] svg { color: var(--ink); }
.side .foot .av { background: var(--surface-raised); color: var(--ink); }

/* botões */
.btn { height: 40px; padding: 0 16px; border-radius: var(--radius-pill); font-weight: 600; background: var(--surface-sunken); border-color: var(--hairline-strong); }
.btn:hover { background: var(--surface-raised); }
.btn.pri, .btn.primary, body.has-shell .top .btn.primary { background: var(--signal); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.btn.pri:hover, .btn.primary:hover, body.has-shell .top .btn.primary:hover { background: var(--signal); border-color: var(--accent); filter: brightness(1.08); }
.btn.gho, .btn.ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn.gho:hover, .btn.ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn.dan, .btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; }

/* cartões e átomos */
.card { border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.av { background: var(--surface-raised); color: var(--ink); font-weight: 700; }
.tile { border-radius: var(--radius-md); }
.chip.on i { animation: rb-pulse 2s infinite; }
.inp, input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea, input[type=color] {
  height: 40px; border-radius: var(--radius-md); background: var(--surface-sunken); border-color: var(--hairline-strong); font-size: 15px; }
textarea { height: auto; }
input[readonly] { background: var(--canvas); }
.field > span { font-weight: 600; color: var(--ink); }
.seg { border-radius: var(--radius-pill); }
.seg button { height: 34px; padding: 0 14px; border-radius: var(--radius-pill); font-weight: 600; }
.seg button[aria-pressed=true], .seg button.on { box-shadow: var(--shadow-sm); }
.tog { background: var(--surface-raised); border: 1px solid var(--hairline-strong); }
.tog::after { background: var(--ink-muted); box-shadow: none; width: 16px; height: 16px; }
.tog[aria-checked=true] { background: var(--signal); border-color: var(--accent); box-shadow: var(--glow); }
.tog[aria-checked=true]::after { background: var(--on-accent); }
.pill { height: 36px; font-weight: 600; }
.pill[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.step em, .card h2 .stepn { background: var(--accent-soft); color: var(--accent); border: 0; font-family: var(--font-sans); font-weight: 700; }
.bar { height: 8px; background: var(--hairline); }
.bar > b { background: linear-gradient(90deg, var(--accent-soft), var(--accent) 70%, var(--signal)); animation: rb-grow 1.2s cubic-bezier(.2,.8,.2,1) both; transform-origin: left; }
.kpi .v { font-family: var(--font-sans); font-size: var(--text-kpi); font-weight: 700; letter-spacing: -.02em; }
.bi[aria-selected=true] { border-color: var(--signal); box-shadow: 0 0 0 1px var(--accent); background: var(--surface); }
.alert { border-radius: var(--radius-lg); }
body.has-shell .top .title b, .sx-main h1, #formTitle { font-family: var(--font-sans); font-weight: 700; }

/* faixa escura da Visão geral */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-xl); margin-bottom: 16px; min-height: 220px; display: flex; align-items: flex-end;
  background: var(--night); color: var(--night-ink); border: 1px solid var(--night-line); }
.hero::before { content: ""; position: absolute; inset: -20%;
  background: radial-gradient(circle at 70% 40%, rgb(30 240 0 / .28), transparent 35%), radial-gradient(circle at 85% 70%, rgb(39 167 196 / .25), transparent 40%);
  animation: rb-drift 14s ease-in-out infinite alternate; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(8 8 8 / .92) 0%, rgb(8 8 8 / .55) 55%, rgb(8 8 8 / .1)); }
.hero .in { position: relative; z-index: 1; padding: 24px; display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; width: 100%; flex-wrap: wrap; }
.hero h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 700; line-height: 1.1; letter-spacing: -.01em; color: var(--night-ink); margin-top: 10px; max-width: 30ch; }
.hero p { margin: 6px 0 0; color: #c9c9c9; max-width: 46ch; }
.hero .chip.on { background: var(--accent-soft); color: var(--accent); }
.hero .live { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero .lv { background: rgb(16 16 16 / .72); backdrop-filter: blur(8px); border: 1px solid var(--night-line); border-radius: var(--radius-lg); padding: 10px 14px; min-width: 150px; color: var(--night-ink); text-decoration: none; }
.hero .lv:hover { border-color: var(--night-line-strong); }
.hero .lv small { display: block; color: var(--night-muted); font-size: 12px; }
.hero .lv b { font-size: 26px; font-variant-numeric: tabular-nums; }
.hero .lv span { color: var(--night-muted); font-size: 13px; margin-left: 4px; }
.hero .acts .btn:not(.pri) { background: rgb(255 255 255 / .06); border-color: var(--night-line-strong); color: var(--night-ink); }
.hero .acts .btn:not(.pri):hover { background: rgb(255 255 255 / .12); }

/* login escuro */
.login { position: fixed; inset: 0; overflow: hidden; background: var(--night); z-index: 20; }
.login::before { content: ""; position: absolute; inset: -20%;
  background: radial-gradient(circle at 70% 40%, rgb(30 240 0 / .28), transparent 35%), radial-gradient(circle at 85% 70%, rgb(39 167 196 / .25), transparent 40%);
  animation: rb-drift 14s ease-in-out infinite alternate; }
.login::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgb(8 8 8 / .35), rgb(8 8 8 / .9)); }
.lbox { position: relative; z-index: 1; background: rgb(16 16 16 / .78); backdrop-filter: blur(14px); border: 1px solid var(--night-line); border-radius: var(--radius-xl); padding: 28px;
  color: var(--night-ink); color-scheme: dark;
  --ink: var(--night-ink); --ink-muted: var(--night-muted); --ink-subtle: var(--night-muted); --surface-sunken: var(--night-3); --hairline-strong: var(--night-line-strong); --surface: var(--night-2); }
.lbox .brand { font-weight: 700; font-size: 22px; }
.lbox .muted { color: var(--night-muted); }
.lbox .btn.pri { width: 100%; }
.sigdraw { color: var(--signal); filter: drop-shadow(0 0 4px rgb(30 240 0 / .6)); }

@keyframes rb-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(30 240 0 / .5); } 60% { box-shadow: 0 0 0 5px rgb(30 240 0 / 0); } }
@keyframes rb-grow { from { transform: scaleX(0); } }
@keyframes rb-drift { to { transform: translate(-8%, 6%) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .hero::before, .login::before, .chip.on i, .bar > b { animation: none !important; } }
@media (max-width: 860px) { .btn { height: 44px; } }
label.btn { display: inline-flex; }
.hero h2 { max-width: 34ch; }

/* ── Modo escuro: peças com cor fixa nas páginas avulsas ─────────────────────
   :is() cobre a escolha manual e o automático do sistema. A prévia do e-mail continua branca de propósito. */
:root[data-theme=dark] { --dark: 1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --dark: 1; } }
.theme-btn .moon { display: none; }
:root[data-theme=dark] .theme-btn .sun { display: none; }
:root[data-theme=dark] .theme-btn .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .theme-btn .sun { display: none; }
  :root:not([data-theme=light]) .theme-btn .moon { display: inline; }
}
:root[data-theme=dark] .structure, :root[data-theme=dark] .blocks li, :root[data-theme=dark] .img-box, :root[data-theme=dark] .group-head, :root[data-theme=dark] input[type=color] { background: var(--surface); border-color: var(--hairline); color: var(--ink); }
:root[data-theme=dark] .img-box { border-color: var(--hairline-strong); }
:root[data-theme=dark] .structure:hover { border-color: var(--hairline-strong); }
:root[data-theme=dark] .st.on { background: var(--success-bg); color: var(--success); }
:root[data-theme=dark] .people tr.sel td { background: var(--accent-soft); }
:root[data-theme=dark] .people select.own { border-color: var(--warning); background: var(--warning-bg); }
:root[data-theme=dark] .sx-list li button.on, :root[data-theme=dark] .audience { border-color: var(--accent-line); }
:root[data-theme=dark] .notice { border-bottom-color: var(--warning-bg); }
:root[data-theme=dark] .btn.danger { border-color: var(--danger); }
:root[data-theme=dark] .toast { background: var(--surface-raised); color: var(--ink); border: 1px solid var(--hairline-strong); }
:root[data-theme=dark] .structure svg { color: var(--ink-muted); }
:root[data-theme=dark] .hero { border-color: var(--hairline); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .structure, :root:not([data-theme=light]) .blocks li, :root:not([data-theme=light]) .img-box, :root:not([data-theme=light]) .group-head, :root:not([data-theme=light]) input[type=color] { background: var(--surface); border-color: var(--hairline); color: var(--ink); }
  :root:not([data-theme=light]) .img-box { border-color: var(--hairline-strong); }
  :root:not([data-theme=light]) .structure:hover { border-color: var(--hairline-strong); }
  :root:not([data-theme=light]) .st.on { background: var(--success-bg); color: var(--success); }
  :root:not([data-theme=light]) .people tr.sel td { background: var(--accent-soft); }
  :root:not([data-theme=light]) .people select.own { border-color: var(--warning); background: var(--warning-bg); }
  :root:not([data-theme=light]) .sx-list li button.on, :root:not([data-theme=light]) .audience { border-color: var(--accent-line); }
  :root:not([data-theme=light]) .notice { border-bottom-color: var(--warning-bg); }
  :root:not([data-theme=light]) .btn.danger { border-color: var(--danger); }
  :root:not([data-theme=light]) .toast { background: var(--surface-raised); color: var(--ink); border: 1px solid var(--hairline-strong); }
  :root:not([data-theme=light]) .structure svg { color: var(--ink-muted); }
  :root:not([data-theme=light]) .hero { border-color: var(--hairline); }
}
.side .foot .out-btn { margin-left: 0; }
.side .foot .btn.sm { padding: 0 8px; }

/* prévia de e-mail é sempre papel branco, em qualquer tema */
.mail { color-scheme: light; --surface: #ffffff; --ink: #141614; --ink-2: #54594f; --ink-3: #666b63; --ink-muted: #54594f; --ink-subtle: #666b63; --line: #e2e4df; --line-2: #eceeea; --hairline: #e2e4df; color: #222; }

/* ── Empresa em edição (menu lateral) ── */
.side .cosel { display: grid; gap: 4px; margin: 0 4px 10px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-sm); min-width: 0; }
.side .cosel b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .cosel select { width: 100%; height: 36px; border: 0; padding: 0 4px; margin: 0 -4px; background: transparent; font: 700 var(--text-sm) var(--font-sans); color: var(--ink); cursor: pointer; }
.side .cosel select:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }
.side .cosel a { color: var(--accent); font-weight: 600; }
@media (max-width: 900px) {
  .side .cosel { flex: none; margin: 0 6px 0 0; padding: 0 8px; border: 0; background: transparent; max-width: 150px; }
  .side .cosel .label { display: none; }
}
/* Empresas (super admin) */
.cos { display: grid; gap: 16px; }
.co-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.co-head h2 { margin: 0; font-size: 18px; }
.co-head .acts { margin-left: auto; }
.co-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-muted); margin: 6px 0 12px; }
.co-meta b { color: var(--ink); font-weight: 600; }
.ms-box { display: grid; gap: 12px; }
.ms-box .big { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ms-box details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: var(--text-sm); }
