/* Visual provisório e simples. O design definitivo será escolhido a partir dos protótipos. */
:root {
  --bg: #E9ECF8;
  --card: #fff;
  --ink: #1A1D3A;
  --muted: #4A4F78;
  --line: #D3D7EC;
  --accent: #FFBED6;
  --accent-ink: #1A1D3A;
  --link: #B0236B;
  --blue: #0B8A5F;
  --ok: #0B8A5F;
  --on: #2FBF86;
  --wait: #7A5200;
  --amber: #FFB703;
  --bad: #C62F3C;
  --radius: 18px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
h1 { font-size: 2.2rem; line-height: 1.05; letter-spacing: -.04em; font-weight: 800; margin: 0 0 16px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.wrap { max-width: 1400px; margin: 0 auto; padding: 16px; }

header.top { background: transparent; }
header.top .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.4rem; letter-spacing: -.03em; margin-right: 8px; text-transform: lowercase; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; display: block; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs a { text-decoration: none; color: var(--ink); padding: 8px 16px; border-radius: 999px; }
nav.tabs a.on { color: var(--ink); background: var(--accent); font-weight: 800; }
.spacer { flex: 1; }
select, input, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.accsel { position: relative; }
.accbtn { display: inline-flex; align-items: center; gap: 10px; background: var(--card); border: 0; border-radius: 999px; padding: 6px 16px 6px 6px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.accbtn .dot, .accmenu .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); object-fit: cover; display: inline-block; flex: none; }
.accmenu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; min-width: 100%; background: var(--card); border-radius: 18px; box-shadow: 0 10px 30px rgba(26,29,58,.18); }
.accmenu[hidden] { display: none; }
.accmenu button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px 14px 6px 6px; border-radius: 999px; font: inherit; color: var(--ink); cursor: pointer; white-space: nowrap; }
.accmenu button:hover, .accmenu button.on { background: #FFE8F0; font-weight: 600; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: .86rem; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: var(--card); border: 0; border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* filtros */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--card); border-radius: 999px; padding: 9px 18px; cursor: pointer; font: inherit; color: var(--ink); text-decoration: none; line-height: 1.2; }
.chip.on { background: var(--accent); color: var(--ink); font-weight: 800; }
.daypick { position: relative; }
.chip.daychip { font-weight: 400; }
.chip.daychip.on { font-weight: 400; }
.cal { position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; width: 300px; background: var(--card); border-radius: 20px; padding: 16px; box-shadow: 0 12px 32px rgba(26,29,58,.2); }
.cal[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; }
.cal-head button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.cal-head button:disabled { color: #C3C7DD; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .dow { font-size: .8rem; color: var(--muted); padding-bottom: 4px; }
.cal-grid button { height: 36px; border: 0; border-radius: 50%; background: transparent; font: inherit; color: var(--ink); cursor: pointer; padding: 0; }
.cal-grid button.sel { background: var(--accent); font-weight: 800; }
.cal-grid button.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-grid button:disabled { color: #B8BCD6; cursor: default; }
table a { color: var(--ink); font-weight: 800; text-decoration: none; }
table a:hover { text-decoration: underline; text-underline-offset: 4px; }

.list { display: flex; flex-direction: column; gap: 12px; }
/* automações: três colunas (rascunhos, esperando o post, no ar) */
.board { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.col { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col.wide { flex: 2 1 560px; }
.col-head { display: flex; align-items: baseline; gap: 10px; padding: 0 4px; }
.col-head h2 { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.col-head span { color: var(--muted); font-size: .95rem; }
.col-empty { color: var(--muted); font-size: .95rem; padding: 14px 16px; border: 2px dashed var(--line); border-radius: var(--radius); }
.item { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; background: var(--card); border-radius: var(--radius); padding: 16px; }
.item.draft { border: 2px dashed #B9BEE0; padding: 14px; }
.item.wait { box-shadow: inset 0 0 0 2px var(--amber); }
.item .info { flex: 1 1 180px; min-width: 0; }
.thumb { width: 56px; height: 70px; border-radius: 10px; object-fit: cover; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem; text-align: center; line-height: 1.2; flex: none; }
.item .name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.item .sub { color: var(--muted); font-size: .9rem; display: block; }
.item .note { color: var(--muted); font-size: .9rem; }
.item .note.amber { color: var(--wait); font-weight: 600; }
.item .foot { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spark { display: flex; flex-direction: column; gap: 2px; flex: none; }
.spark small { font-size: .8rem; color: var(--muted); }
.spark svg { display: block; }
.stats { display: flex; gap: 40px; padding: 0 12px; flex: none; }
.stats span { text-align: center; min-width: 64px; font-size: .82rem; color: var(--muted); }
.stats b { display: block; color: var(--ink); font-size: 1.6rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stats span.ctr b { color: var(--blue); }
.badge { font-size: .75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; margin-right: 6px; }
.badge.on { color: var(--ok); }
.badge.wait { color: var(--wait); }
.badge.off { color: var(--muted); }
.failed { color: var(--bad); font-size: .85rem; }

/* alça de arrastar */
.handle { flex: none; border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: grab; padding: 6px 0; touch-action: none; border-radius: 6px; }
.handle:active { cursor: grabbing; }
.item.dragging { box-shadow: 0 8px 24px rgba(26,29,58,.25); z-index: 2; }

/* interruptor */
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: #C9CDE8; border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--on); }
.switch.wait input:checked + span { background: var(--amber); }
.switch input:checked + span::after { transform: translateX(22px); }

/* editor */
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.preview-col { position: sticky; top: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--card); padding: 8px; cursor: pointer; font: inherit; color: var(--muted); border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: var(--ink); font-weight: 800; }
.opt { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-weight: 400; }
.opt input { width: auto; margin-top: 4px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kw span { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; display: inline-flex; gap: 4px; align-items: center; }
.kw button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; }
.btnrow { display: grid; grid-template-columns: 1fr 2fr auto; gap: 6px; margin-top: 6px; }
.prod { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; }
.prod-head { display: flex; gap: 10px; align-items: center; }
.prod-head img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.count { float: right; font-weight: 400; color: var(--muted); font-size: .8rem; }
.selected-post { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.selected-post img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.footer-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.error { color: var(--bad); font-weight: 600; }

/* prévia (celular) */
.phone { border: 1px solid var(--line); border-radius: 28px; background: #fff; color: #111; padding: 14px 10px; min-height: 460px; }
.phone .ph-head { display: flex; gap: 8px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #eee; font-weight: 600; font-size: .9rem; }
.phone .ph-head img, .phone .ph-head .av { width: 28px; height: 28px; border-radius: 50%; background: #ddd; }
.phone .sys { color: #777; font-size: .72rem; text-align: center; margin: 12px 8px; }
.phone .bubble { background: #efefef; border-radius: 18px; padding: 10px 12px; font-size: .88rem; white-space: pre-wrap; max-width: 88%; }
.phone .tpl { background: #efefef; border-radius: 18px; overflow: hidden; max-width: 88%; }
.phone .tpl .t { padding: 10px 12px; font-size: .88rem; white-space: pre-wrap; }
.phone .tpl .b { background: #fff; margin: 0 8px 8px; border-radius: 10px; padding: 8px; text-align: center; font-weight: 600; font-size: .85rem; }
.phone .car { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.phone .car .c { flex: 0 0 78%; background: #efefef; border-radius: 16px; overflow: hidden; scroll-snap-align: start; }
.phone .car .c img, .phone .car .c .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #ddd; }
.phone .car .c .ti { font-weight: 600; font-size: .85rem; padding: 8px 10px 0; }
.phone .car .c .st { color: #666; font-size: .78rem; padding: 0 10px; }
.phone .car .c .b { background: #fff; margin: 6px 8px; border-radius: 10px; padding: 7px; text-align: center; font-weight: 600; font-size: .8rem; }

/* modal */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); width: min(720px, 94vw); max-height: 88vh; padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.media-grid button { border: 2px solid transparent; padding: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; position: relative; text-align: left; color: var(--ink); }
.media-grid button img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-grid button small { display: block; font-size: .72rem; padding: 2px 4px; color: var(--muted); }
.media-grid button.on { border-color: var(--accent); }
.media-grid button.on::before { content: "✓"; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; z-index: 1; }
.posts-picked { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.picked { position: relative; width: 64px; }
.picked img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; background: var(--bg); }
.picked .rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; line-height: 1; }
.picked small { display: block; font-size: .68rem; color: var(--ok); text-align: center; }
.thumbwrap { position: relative; display: inline-block; }
.more-posts { position: absolute; bottom: 2px; right: 2px; background: rgba(0,0,0,.7); color: #fff; font-size: .7rem; padding: 0 5px; border-radius: 6px; }
.media-grid button.used::after { content: "já tem automação"; position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .68rem; padding: 1px 6px; border-radius: 6px; }

/* insights */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--card); border: 0; border-radius: var(--radius); padding: 12px 14px; }
.kpi b { font-size: 2rem; font-weight: 800; line-height: 1.1; display: block; }
.kpi.ctr b { color: var(--ok); }
.kpi span { color: var(--muted); font-size: .86rem; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.bars .day { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bars .bar { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; }
.bars .bar i { position: absolute; bottom: 0; left: 0; right: 0; background: var(--ok); border-radius: 4px 4px 0 0; }
.bars .day small { font-size: .65rem; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); font-size: .9rem; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }

.log { font-size: .82rem; max-height: 320px; overflow: auto; }
.log div { border-top: 1px solid var(--line); padding: 6px 0; }
.log code { color: var(--muted); word-break: break-all; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
.login { max-width: 360px; margin: 12vh auto; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 640px) { .stats { flex: 1 1 100%; gap: 8px; padding: 0; justify-content: space-between; } .stats span { min-width: 0; } }

/* interruptor rosa (no lugar do checkbox) */
.tgl { position: relative; display: flex; gap: 14px; align-items: flex-start; margin: 12px 0; font-weight: 400; cursor: pointer; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tgl .sw { flex: none; position: relative; width: 52px; height: 30px; border-radius: 999px; background: #C9CDE8; transition: background .15s; }
.tgl .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s, background .15s; }
.tgl input:checked + .sw { background: var(--accent); }
.tgl input:checked + .sw::after { transform: translateX(22px); background: var(--ink); }
.tgl input:focus-visible + .sw { outline: 2px solid var(--ink); outline-offset: 2px; }
.tgl .txt { padding-top: 4px; line-height: 1.4; }
.tgl.invalid { background: #FFF1F2; border-radius: 14px; box-shadow: 0 0 0 6px #FFF1F2; }

/* erros bem visíveis */
.invalid { border-color: var(--bad) !important; background: #FFF1F2 !important; box-shadow: 0 0 0 3px rgba(198, 47, 60, .22); }
button.invalid { color: var(--bad); }
.err-msg { margin: 6px 0 4px; padding: 8px 12px; border-radius: 10px; background: var(--bad); color: #fff; font-weight: 600; font-size: .92rem; }
#ed-err:not(:empty) { margin: 12px 0; padding: 12px 16px; border-radius: 14px; background: var(--bad); color: #fff; font-weight: 600; }

/* toggle e "⋯" alinhados; menu fecha ao clicar fora */
.ctl { display: flex; align-items: center; gap: 10px; flex: none; }
details.more { position: relative; display: flex; align-items: center; }
.ctl .switch { display: block; margin: 0; }
details.more > summary { list-style: none; display: flex; align-items: center; justify-content: center; box-sizing: border-box; height: 32px; min-width: 40px; padding: 0 10px; line-height: 1; }
.ctl .switch { height: 32px; width: 56px; }
.ctl .switch span::after { top: 4px; left: 4px; width: 24px; height: 24px; }
.ctl .switch input:checked + span::after { transform: translateX(24px); }
details.more > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--card); border-radius: 16px; padding: 8px; display: grid; gap: 4px; box-shadow: 0 10px 30px rgba(26, 29, 58, .22); min-width: 150px; }
.menu-pop .btn { justify-content: flex-start; }

/* prévia: título em no máximo 2 linhas, botões alinhados embaixo */
.phone .car { align-items: stretch; }
.phone .car .c { display: flex; flex-direction: column; }
.phone .car .c .ti { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; line-height: 1.3; }
.phone .car .c .st { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone .car .c .bs { margin-top: auto; }

/* celular: 16px nos campos evita o zoom automático do iPhone; nada vaza para o lado */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg, video { max-width: 100%; }
@media (max-width: 640px) {
  main { padding-left: 14px; padding-right: 14px; }
  .col, .col.wide { flex: 1 1 100%; min-width: 0; }
  .row { flex-wrap: wrap; }
  .filters { flex-wrap: wrap; }
  .cal { max-width: calc(100vw - 28px); }
}

/* tabelas viram mini-cards no celular: nada passa da borda do card */
.card { min-width: 0; }
@media (max-width: 640px) {
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; padding: 12px 0; border-top: 1px solid var(--line); }
  table.stack td { border: 0; padding: 0; min-width: 0; overflow-wrap: anywhere; text-align: left; }
  table.stack td.nm { grid-column: 1 / -1; font-size: 1rem; }
  table.stack td[data-l] { text-align: left; }
  table.stack td[data-l]::before { content: attr(data-l); display: block; font-size: .74rem; color: var(--muted); font-weight: 600; }
  /* por produto: botão ocupa a linha, depois cliques/pessoas/barra */
  table.stack.prod tr { grid-template-columns: 1fr 1fr; }
  table.stack.prod td[data-l="Botão"] { grid-column: 1 / -1; }
  table.stack.prod td.bar { grid-column: 1 / -1; }
  table.stack.prod td.nm img { margin-bottom: 4px; }
}

/* topo no celular: marca + conta + sair (só ícone) na 1ª linha; abas numa linha própria, iguais */
.logout { gap: 6px; }
@media (max-width: 640px) {
  header.top .wrap { flex-wrap: wrap; gap: 8px 10px; }
  .brand { margin-right: 0; font-size: 1.15rem; }
  .logout { order: 2; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%; }
  .logout .lbl { display: none; }
  header.top .wrap { justify-content: space-between; }
  .brand-t { display: none; }
  header.top .spacer { display: none; }
  .accsel { order: 1; min-width: 0; flex: 0 1 auto; max-width: calc(100% - 110px); }
  .brand { order: 0; }
  .accbtn { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; padding-right: 10px; }
  nav.tabs { order: 3; flex: 1 1 100%; display: flex; gap: 6px; }
  nav.tabs a { flex: 1 1 0; min-width: 0; text-align: center; padding: 8px 4px; font-size: .88rem; white-space: nowrap; }
}

/* menu fixo no topo ao rolar */
header.top { position: sticky; top: 0; z-index: 40; background: rgba(233, 236, 248, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.preview-col { top: 76px; }
.invalid, .err-msg, #ed-err { scroll-margin-top: 120px; }

/* avisos de saúde */
#alert-bar:empty { display: none; }
.alert-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 16px; border-radius: 14px; text-decoration: none; color: #fff; font-weight: 600; }
.alert-bar.crit { background: var(--bad); }
.alert-bar.warn { background: var(--amber); color: var(--ink); }
.alert-bar span { font-weight: 400; }
.alert-bar .go { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.alert-item { padding: 10px 14px; border-radius: 12px; margin: 8px 0; border-left: 5px solid var(--amber); background: #FFF6E0; }
.alert-item.crit { border-left-color: var(--bad); background: #FDE8EC; }
.alert-item small { color: var(--muted); }
.ok-line { color: var(--ok); font-weight: 700; }
.hrow { gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.pill.ok { background: #DDF5EA; color: var(--ok); }
.pill.warn { background: #FFF0C7; color: #7A5300; }
.pill.bad { background: #FDE0E6; color: var(--bad); }
.warn-note { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: #FFF0C7; color: #5C3F00; font-size: .92rem; }

/* variações do texto da DM */
details.alts { margin-top: 10px; }
details.alts > summary { cursor: pointer; font-weight: 700; color: var(--link); padding: 4px 0; }
details.alts textarea { min-height: 70px; }

/* ligar sozinha */
.note.sched { color: var(--link); font-weight: 600; }
.editor > *, #ed, #ed .card { min-width: 0; }

/* botões mais visíveis e com resposta ao passar o mouse / tocar (pedido da Amanda) */
.btn { border: 1.5px solid #B9BEDB; font-weight: 600; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s; }
.btn:hover:not(:disabled) { background: #FFE8F0; border-color: #FF8FBA; box-shadow: 0 2px 8px rgba(176, 35, 107, .12); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: #FFA3C6; border-color: #FFA3C6; box-shadow: 0 4px 14px rgba(255, 140, 186, .45); }
.btn.danger { color: var(--rm); border-color: #B9C8F2; }
.btn.danger:hover:not(:disabled) { background: var(--rm-bg); border-color: var(--rm); color: var(--rm); }
.btn.x { color: var(--rm); background: var(--rm-bg); border-color: #B9C8F2; font-size: 1.1rem; font-weight: 800; min-width: 40px; justify-content: center; }
.btn.x:hover:not(:disabled) { background: var(--rm); border-color: var(--rm); color: #fff; box-shadow: none; }
.btn.add { color: var(--link); background: #FFF5F9; border: 1.5px dashed #FF8FBA; font-weight: 700; }
.btn.add:hover:not(:disabled) { background: #FFE0EC; border-style: solid; }
.seg button { transition: background .15s, color .15s; }
.seg button:hover:not(.on) { background: #FFE0EC; color: var(--ink); }
.chip { transition: background .15s; }
.chip:hover:not(.on) { background: #FFE8F0; }
nav.tabs a { transition: background .15s; }
nav.tabs a:hover:not(.on) { background: rgba(255, 190, 214, .45); }
.menu-pop .btn { border-color: transparent; box-shadow: none; }
.menu-pop .btn:hover:not(:disabled) { background: #FFE8F0; border-color: #FFBED6; box-shadow: none; }
.menu-pop .btn.danger:hover:not(:disabled) { background: var(--rm-bg); border-color: #B9C8F2; }
.kw button { transition: color .15s, background .15s; border-radius: 50%; }
.kw button:hover { color: #fff; background: var(--rm); }
details.more > summary.btn { cursor: pointer; }
/* variações do texto */
.alts { margin-top: 10px; }
.alt-row { margin-top: 8px; }
.alt-line { display: flex; gap: 6px; align-items: flex-start; }
.alt-line textarea { flex: 1; min-height: 70px; }

/* remover/excluir em azul (a Amanda não gostou do vermelho com o rosa) */
:root { --rm: #2F5BD3; --rm-bg: #EEF2FF; }
/* Ligar sozinha: dia (calendário) + hora lado a lado */
.sched-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; }
.sched-row > div { flex: 0 1 200px; min-width: 150px; }
.sched-row input[type=time] { width: 100%; }
.pickbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 10px 14px; border: 1.5px solid #B9BEDB; border-radius: 12px; background: var(--card); font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.pickbtn:hover { border-color: #FF8FBA; background: #FFF5F9; }
.pickbtn[aria-expanded=true] { border-color: #FF8FBA; }
/* variações: espaço antes do "+ Adicionar variação" */
.alts > .btn.add { margin-top: 12px; }
/* opções em bolinha (janela "Colar links dos produtos") */
.radios { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.radio { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 1.5px solid var(--line, #DDE1F0); border-radius: 12px; cursor: pointer; font-weight: 500; background: var(--card); }
.radio:hover { background: #FFF5F9; border-color: #FF8FBA; }
.radio input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; border: 2px solid #9AA0C3; border-radius: 50%; background: #fff; display: grid; place-content: center; cursor: pointer; }
.radio input::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .12s; }
.radio input:checked { border-color: var(--ink); }
.radio input:checked::before { transform: scale(1); }
.radio:has(input:checked) { border-color: var(--ink); background: #FFF0F6; }
.radio input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* cards da lista com a mesma altura: nome em 1 linha, gatilho em até 2 */
.item .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .foot .note { min-height: 2.8em; display: flex; align-items: center; line-height: 1.4; }
.item:not(.draft):not(.wait) .info { min-height: 5.6rem; }
.item .failed { display: block; font-size: .85rem; line-height: 1.4; }
/* escolher posts: só a grade rola, título e botão sempre à vista */
dialog.mp[open] { display: flex; flex-direction: column; padding: 0; height: min(760px, 88vh); max-height: 88vh; overflow: hidden; }
.mp-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); flex: none; }
.mp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.mp-foot { flex: none; display: flex; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--card); }
@media (max-width: 640px) { .mp-foot .btn { flex: 1; justify-content: center; } }
/* Configurações estilo lista do iPhone: cada linha abre uma tela própria */
.scard { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 14px 16px; text-decoration: none; color: var(--ink); margin-bottom: 6px; }
.scard .st { flex: 1; min-width: 0; }
.scard b { display: block; }
.scard small { color: var(--muted); font-size: .85rem; }
.scard .sdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--on); box-shadow: 0 0 0 5px #DDF6EC; margin: 0 4px; }
.scard.warn .sdot { background: var(--amber); box-shadow: 0 0 0 5px #FFF1CC; }
.scard.bad .sdot { background: var(--bad); box-shadow: 0 0 0 5px #FDE0E6; }
.scard:hover, .srow:hover { background: #FFF5F9; }
.sgh { margin: 18px 6px 6px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }
.sgn { margin: 6px 8px 0; color: var(--muted); font-size: .82rem; }
.sgroup { background: var(--card); border-radius: 18px; overflow: hidden; }
.srow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; text-decoration: none; color: var(--ink); border-top: 1px solid #E3E6F3; }
.srow:first-child { border-top: 0; }
.srow .st { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .sv { color: var(--muted); font-size: .88rem; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow.add .st { color: var(--link); font-weight: 600; }
.chev { color: #9AA0C3; flex: none; }
.sback svg { margin-right: 6px; }
.sic { width: 32px; height: 32px; border-radius: 10px; background: #FFE8F0; color: var(--link); display: flex; align-items: center; justify-content: center; flex: none; }
.sav { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); flex: none; object-fit: cover; }
.bad-t { color: var(--bad); font-weight: 700; }
.warn-t { color: var(--wait); font-weight: 700; }
.sback { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 600; color: var(--link); margin-bottom: 4px; }
/* "Ligar sozinha" pelo card: a nota vira botão que abre a janela de dia e hora */
button.note.sched { border: 0; background: #FFF0F6; border-radius: 10px; padding: 0 8px; font: inherit; font-size: .88rem; line-height: 1.3; max-height: 2.8em; cursor: pointer; text-align: left; gap: 6px; min-height: 2.8em; }
button.note.sched svg { flex: none; }
.item .note.amber { flex-direction: column; align-items: flex-start; justify-content: center; }
.item .note.amber small { font-weight: 400; color: var(--muted); font-size: .8rem; line-height: 1.2; }
dialog.schd { width: min(380px, 94vw); }
.cal.inline { position: static; width: 100%; box-shadow: none; padding: 4px 0; border-radius: 0; }
.sd-time { margin-top: 6px; }
.sd-time input { max-width: 180px; }
.sd-foot { margin-top: 8px; }

/* revisão de UX do "Ligar sozinha" */
.btn[hidden], .warn-note[hidden] { display: none !important; }
.menu-pop .btn { white-space: nowrap; text-align: left; }
.menu-pop { max-width: calc(100vw - 32px); }
.lbl { display: block; font-weight: 600; margin: 10px 0 4px; }
.cal.inline .cal-grid button { height: 42px; }
.cal-head button { width: 40px; height: 40px; }
@media (hover: hover) {
  .cal-grid button:hover:not(:disabled):not(.sel) { background: #FFE8F0; }
  button.note.sched:hover { background: #FFE0EC; }
}
@media (max-width: 640px) { button.note.sched { min-height: 44px; max-height: none; } }
.item.flash { animation: apflash 1.6s ease-out; }
@keyframes apflash { 0%, 40% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 640px) { .item .foot .note { min-height: 44px; } }

/* Configurações responsiva: computador = lista à esquerda + item à direita; celular = lista e telas separadas */
.cfg-h1, .cfg { max-width: 1120px; margin-left: auto; margin-right: auto; }
.cfg { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.cfg-nav { position: sticky; top: 84px; }
.cfg-pane { min-width: 0; }
.cfg-pane .card:first-of-type { margin-top: 0; }
.pane-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 14px; }
.srow.on, .scard.on { background: #FFF0F6; box-shadow: inset 4px 0 0 var(--accent); }
.sback { display: none; }
@media (max-width: 760px) {
  .cfg { display: block; }
  .cfg-nav { position: static; }
  .cfg.has-ver .cfg-nav, .cfg:not(.has-ver) .cfg-pane, .cfg-h1.has-ver { display: none; }
  .sback { display: inline-flex; }
  .srow.on, .scard.on { background: var(--card); box-shadow: none; }
}
@media (min-width: 761px) { .cfg-nav .chev { opacity: .45; } }

/* ===== revisão completa de UX/UI (13/10) ===== */
/* ícones de traço nos menus e listas */
.ico { flex: none; }
.menu-pop .btn { gap: 10px; }
.menu-pop .btn .ico { color: var(--muted); }
.menu-pop .btn.danger .ico { color: var(--rm); }
.sic.rm { background: var(--rm-bg); color: var(--rm); }
.sic .ico { width: 18px; height: 18px; }

/* Configurações: "Configurações" e o título do item aberto na mesma linha */
.cfg-h1, .cfg { max-width: none; margin-left: 0; margin-right: 0; }
.cfg { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); column-gap: 28px; row-gap: 0; align-items: start; }
.cfg-h1 { margin: 0 0 16px; align-self: end; }
.pane-head { align-self: end; margin-bottom: 16px; min-width: 0; }
.pane-title { margin: 0; font-size: 1.6rem; line-height: 1.2; }
.cfg-notice { grid-column: 1 / -1; }
.cfg-pane > .card:first-child { margin-top: 0; }
@media (max-width: 760px) {
  .cfg { display: block; }
  .cfg.has-ver .cfg-h1, .cfg:not(.has-ver) .pane-head { display: none; }
  .pane-head .sback { display: inline-flex; }
}
.kv { margin: 14px 0 0; display: grid; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.log { max-height: none; overflow: visible; }
.ev { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev-l span { color: var(--muted); }
.ev small { color: var(--muted); white-space: nowrap; }
.ev details { grid-column: 1 / -1; font-size: .8rem; }
.ev summary { cursor: pointer; color: var(--muted); }
.ev code { display: block; word-break: break-all; color: var(--muted); }

/* lista: botão "+ Nova automação" e cards "No ar" */
.list-top { justify-content: flex-end; margin-bottom: 4px; }
.board { margin-top: 8px; }
.item .ctl { margin-left: auto; }
button.note.sched { white-space: nowrap; overflow: hidden; max-width: 100%; }
button.note.sched span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .new-auto { flex: 1; justify-content: center; min-height: 48px; }
  .item.live .info { min-height: 0; }
  .item.live .stats { order: 2; flex: 1 1 100%; }
  .item.live .spark { order: 3; flex-direction: row; align-items: center; gap: 8px; }
  .item.live .ctl { order: 4; }
}

/* editor: barra de salvar flutuante, prévia no celular, opções que cabem */
.footer-actions { bottom: 12px; margin-top: 14px; padding: 10px 12px; background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 18px; box-shadow: 0 6px 24px rgba(26, 29, 58, .16); z-index: 5; }
.pv-m { display: none; margin-bottom: 14px; }
.pv-m > summary { list-style: none; width: 100%; justify-content: center; }
.pv-m > summary::-webkit-details-marker { display: none; }
.pv-m[open] > summary { margin-bottom: 10px; }
#kw-input { margin-top: 10px; }
@media (max-width: 900px) {
  aside.preview-col { display: none; }
  .pv-m { display: block; }
}
@media (max-width: 640px) {
  .footer-actions { bottom: 8px; margin-bottom: env(safe-area-inset-bottom); }
  .footer-actions .btn { flex: 1; justify-content: center; min-height: 48px; }
  .seg button { padding: 10px 4px; font-size: .9rem; line-height: 1.2; min-height: 44px; }
  h1 { font-size: 1.8rem; }
}

/* topo: "Sair" redondo no tablet, pílula de 38 px no computador */
.logout { height: 38px; border-radius: 999px; }
@media (max-width: 900px) {
  .logout { width: 38px; padding: 0; justify-content: center; border-radius: 50%; }
  .logout .lbl { display: none; }
}

/* faixa de aviso no celular */
@media (max-width: 640px) {
  .alert-bar { flex-wrap: wrap; gap: 4px 10px; }
  .alert-bar b { flex: 1 1 100%; }
}

/* Resultados: filtros e calendário no celular */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; position: relative; }
  .filters .chip { justify-content: center; padding: 9px 4px; text-align: center; }
  .filters .daypick { grid-column: span 2; position: static; }
  .filters .daypick .chip { width: 100%; }
  .filters .cal { left: 0; right: 0; width: auto; max-width: none; }
}

/* escolher posts: miniaturas menores, legenda, altura conforme o conteúdo */
.media-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
.media-grid .thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; }
dialog.mp[open] { height: auto; }
.media-grid .cap { display: block; font-size: .72rem; padding: 0 4px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }

/* login */
.login { margin: 14vh auto; padding: 24px; }
.login h1 { text-transform: lowercase; }
.login .btn { width: 100%; justify-content: center; min-height: 48px; margin-top: 4px; }
@media (min-width: 641px) { .filters .daypick .cal { left: auto; right: 0; } }
/* modo de espera (pausa geral) na Saúde */
.pause-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-radius: 12px; background: #F4F5FB; margin-bottom: 12px; font-size: .92rem; }
.pause-box b { flex: 1 1 100%; }
.pause-box span { flex: 1 1 240px; color: var(--muted); }
.pause-box.bad { background: #FDE8EC; }
.pause-box.bad b { color: var(--bad); }
.pause-box.warn { background: #FFF6E0; }
/* Configurações por conta: linha da conta abre os itens (computador) */
.acc-d > summary { list-style: none; cursor: pointer; }
.acc-d > summary::-webkit-details-marker { display: none; }
.acc-d .chev.dd { transition: transform .15s; }
.acc-d[open] > summary .chev.dd { transform: rotate(180deg); }
.acc-sub { background: #F7F8FC; }
.acc-sub .srow { padding-left: 28px; }
.acc-sub .srow .sic { width: 28px; height: 28px; }
.ev-acc { font-size: .78rem; font-weight: 700; color: var(--link); background: #FFE8F0; border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
.cfg-pane .filters { margin: 8px 0 12px; }
/* celular: itens da conta são gavetas que abrem para baixo (uma por vez) */
.it-d > summary { list-style: none; cursor: pointer; }
.it-d > summary::-webkit-details-marker { display: none; }
.it-d[open] > summary .chev.dd { transform: rotate(180deg); }
.it-d .chev.dd { transition: transform .15s; }
.it-body { background: #fff; }
.it-body:not(:empty) { border-top: 1px solid #E3E6F3; padding: 4px 4px 0; }
.it-body .card { margin-bottom: 8px; padding: 12px; background: transparent; }
.it-body textarea { max-width: 100%; }
