/* Identidade visual: Paróquia São João Bosco — marinho #131e45, dourado #c7b077, creme #f7f4e9.
   Fontes oficiais: Cinder (títulos, sempre em maiúsculas) e Petrona. Para usar a Cinder, coloque
   o arquivo em public/brand/fonts/Cinder.woff2 (ou instale no computador); sem ela, usa a Petrona. */
@font-face {
  font-family: "Cinder";
  src: local("Cinder"), local("Cinder Regular"), url("/brand/fonts/Cinder.woff2") format("woff2");
  font-display: swap;
}

:root {
  --navy: #131e45;
  --navy-2: #1c2a5c;
  --brand-gold: #c7b077;
  --brand-cream: #f7f4e9;

  --bg: #f7f4e9;
  --surface: #fffdf7;
  --surface-2: #f1ecdc;
  --ink: #131e45;
  --muted: #5d6585;
  --line: #e4dcc6;
  --line-strong: #d3c7a6;
  --accent: #131e45;
  --accent-hover: #1c2a5c;
  --accent-soft: #e8e3d0;
  --accent-ink: #f7f4e9;
  --gold: #8a733c;          /* dourado escurecido para texto legível sobre creme */
  --gold-line: #c7b077;     /* dourado da marca para linhas e detalhes */
  --gold-soft: #f1e9d2;

  --ig: #b3367a;
  --yt: #c3302a;
  --pod: #1b7f45;

  --st-draft: #7c8199;
  --st-scheduled: #93722c;
  --st-publishing: #2f68ae;
  --st-published: #2c7a4b;
  --st-partial: #bd6a12;
  --st-failed: #b3261e;

  --side-bg: #131e45;
  --side-ink: #f7f4e9;
  --side-muted: #b9bdd0;
  --side-hover: rgba(247, 244, 233, .08);
  --side-active: rgba(199, 176, 119, .18);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(19, 30, 69, .06), 0 6px 20px rgba(19, 30, 69, .07);
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Petrona", Georgia, serif;
  --title: "Cinder", "Petrona", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1230;
    --surface: #131b40;
    --surface-2: #1a2350;
    --ink: #f7f4e9;
    --muted: #a9afc8;
    --line: #26305e;
    --line-strong: #364175;
    --accent: #c7b077;
    --accent-hover: #d6c291;
    --accent-soft: #2a2f4f;
    --accent-ink: #131e45;
    --gold: #d6c291;
    --gold-line: #c7b077;
    --gold-soft: #2b2c45;
    --ig: #e06aaa;
    --yt: #ee6b62;
    --pod: #4cc57f;
    --st-draft: #9da3bd;
    --st-scheduled: #d6c291;
    --st-publishing: #74a7ea;
    --st-published: #5fc48a;
    --st-partial: #eda350;
    --st-failed: #f07a72;
    --side-bg: #080d24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1.2; }
h1 { font-family: var(--title); font-weight: 400; font-size: 30px; text-transform: uppercase; letter-spacing: .03em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-family: var(--font); font-weight: 700; }
small, .muted { color: var(--muted); }
.kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
/* divisória inspirada na divisória oficial: linha dourada com losangos nas pontas */
.ornament { display: flex; align-items: center; gap: 0; height: 9px; margin: 10px 0 0; width: 150px; }
.ornament::before, .ornament::after { content: ""; width: 7px; height: 7px; background: var(--gold-line); transform: rotate(45deg); flex: none; }
.ornament i { flex: 1; height: 1.5px; background: var(--gold-line); margin: 0 3px; }
.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--st-failed); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.icon { padding: 8px; }
.btn.block { width: 100%; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled, select:disabled { opacity: .65; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.counter { font-size: 12.5px; color: var(--muted); text-align: right; margin-top: -8px; margin-bottom: 12px; }
.counter.over { color: var(--st-failed); font-weight: 600; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.seg label { padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; border-right: 1px solid var(--line-strong); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; align-self: start; display: flex; flex-direction: column; gap: 18px;
  padding: 24px 16px 18px; background: var(--side-bg); color: var(--side-ink); overflow-y: auto;
  background-image: linear-gradient(180deg, rgba(19,30,69,.0) 40%, var(--side-bg) 92%), url("/brand/padrao.png");
  background-size: auto, 900px auto; background-position: top left, -40px -20px;
  box-shadow: inset -1px 0 0 rgba(199,176,119,.35);
}
.side::before { content: ""; position: absolute; inset: 0; background: var(--side-bg); opacity: .9; pointer-events: none; }
.side > * { position: relative; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px; text-decoration: none; }
.brand img { width: 40px; height: auto; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.brand b { font-family: var(--title); font-weight: 400; font-size: 22px; letter-spacing: .05em; text-transform: uppercase; display: block; line-height: 1.05; }
.brand small { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--brand-gold); display: block; margin-top: 3px; }
.side .btn.primary { background: var(--brand-gold); border-color: var(--brand-gold); color: var(--navy); }
.side .btn.primary:hover { background: #d6c291; border-color: #d6c291; }
.side .btn.ghost { color: var(--side-ink); }
.side .btn.ghost:hover { background: var(--side-hover); }
.side .lema { width: 120px; opacity: .9; margin: 4px 0 0 8px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; gap: 11px; align-items: center; padding: 9px 10px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 600; color: var(--side-muted); border-left: 2px solid transparent;
}
.nav a:hover { background: var(--side-hover); color: var(--side-ink); }
.nav a.active { background: var(--side-active); color: var(--brand-gold); border-left-color: var(--brand-gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.side .me { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(199,176,119,.3); font-size: 13.5px; }
.side .me small { color: var(--side-muted); }
.side .me b { display: block; }
.conn { display: grid; gap: 6px; font-size: 12.5px; padding: 0 10px; }
.conn div { display: flex; gap: 8px; align-items: center; color: var(--side-muted); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: rgba(247,244,233,.25); }
.conn i.on { background: #5fc48a; }

main { min-width: 0; padding: 26px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { overflow-wrap: anywhere; }
.banner {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 18px;
  border-radius: var(--radius-sm); background: var(--gold-soft); color: var(--gold); font-size: 14px; font-weight: 500;
  border-left: 3px solid var(--gold-line);
}
.banner a { font-weight: 700; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 14px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

.tabbar { display: none; }

/* ---------- Calendário ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold-line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week div { padding: 9px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-week div:first-child { color: var(--gold); }
.day { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.day:nth-child(7n) { border-right: 0; }
.day.out { background: var(--surface-2); }
.day.out .num { opacity: .45; }
.day.sel { box-shadow: inset 0 0 0 2px var(--gold-line); }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.num { font-weight: 600; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.day.today .num { background: var(--navy); color: var(--brand-cream); box-shadow: 0 0 0 2px var(--gold-line); }
.day.sun .num { color: var(--gold); }
.day.today.sun .num { color: var(--brand-cream); }
.day .add { opacity: 0; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.day:hover .add { opacity: 1; }
.day .add:hover { background: var(--surface-2); color: var(--accent); }
.chips { display: grid; gap: 3px; }
.chip {
  display: flex; gap: 5px; align-items: center; padding: 3px 6px; border-radius: 6px;
  font-size: 12px; text-decoration: none; background: var(--surface-2); border-left: 3px solid var(--st);
  overflow: hidden; white-space: nowrap;
}
.chip:hover { background: var(--accent-soft); }
.chip time { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip .t { overflow: hidden; text-overflow: ellipsis; }
.chip .plats { display: inline-flex; gap: 1px; }
.chip .plats .ic { width: 12px; height: 12px; }
.dots { display: none; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.st-draft { --st: var(--st-draft); }
.st-scheduled { --st: var(--st-scheduled); }
.st-publishing { --st: var(--st-publishing); }
.st-published { --st: var(--st-published); }
.st-partial { --st: var(--st-partial); }
.st-failed { --st: var(--st-failed); }
.st-pending { --st: var(--st-scheduled); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 12px 2px 0; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }

.day-panel { margin-top: 20px; }
.day-panel h2 { margin-bottom: 12px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }

/* ---------- Cartões de publicação ---------- */
.list { display: grid; gap: 10px; }
.pcard {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 10px; padding-right: 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; transition: border-color .15s;
}
.pcard:hover { border-color: var(--line-strong); }
.thumb {
  width: 64px; height: 64px; border-radius: var(--radius-sm); background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden; color: var(--muted);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.pcard .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.pcard .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; color: var(--st); background: color-mix(in srgb, var(--st) 13%, transparent);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.badge.plain::before { display: none; }
.pbadge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 7px 3px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.pbadge .ic { width: 14px; height: 14px; }
.pbadge i { width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.c-instagram { color: var(--ig); }
.c-youtube { color: var(--yt); }
.c-podcast { color: var(--pod); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.filters a { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.filters a.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.group-day { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 2px 8px; }
.group-day:first-child { margin-top: 0; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.editor-main { min-width: 0; }
/* Prévia fixa: acompanha a rolagem e rola por dentro se for maior que a tela */
.editor-side { position: sticky; top: 16px; display: grid; gap: 14px; align-content: start;
  max-height: calc(100vh - 32px - 76px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; scrollbar-width: thin; }
.editor-side .card + .card { margin-top: 0; }
.side-close { display: none; }
.history summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.history summary h2 { margin: 0; }
.history[open] summary { margin-bottom: 12px; }
.result-card { border-left: 3px solid var(--gold-line); }

/* Barra de ações fixa no rodapé do editor */
.actionbar { position: sticky; bottom: 0; z-index: 30; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin: 22px -32px -60px; padding: 12px 32px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px rgba(19, 30, 69, .08); }
.ab-when { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.ab-date input { padding: 8px 10px; width: auto; }
.ab-when .quick { margin: 0; }
.ab-label { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.ab-warn { color: var(--st-partial); font-weight: 600; }
.ab-issues { white-space: nowrap; flex: none; display: inline-flex; gap: 6px; align-items: center; border: 0; border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ab-issues .ic { width: 15px; height: 15px; }
.ab-issues.err { background: color-mix(in srgb, var(--st-failed) 13%, transparent); color: var(--st-failed); }
.ab-issues.warn { background: color-mix(in srgb, var(--st-partial) 13%, transparent); color: var(--st-partial); }
.ab-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.ab-pv { display: none !important; }

/* Mídia: arrastar para reordenar */
.tile[draggable="true"] { cursor: grab; }
.tile.dragging { opacity: .4; }
.tile.drop-target { outline: 3px dashed var(--gold-line); outline-offset: -3px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.back:hover { color: var(--ink); }

.drop {
  display: grid; justify-items: center; gap: 4px;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; text-align: center;
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop b { color: var(--ink); }
.progress { width: 100%; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.tile { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); aspect-ratio: 1; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .audio { display: grid; place-items: center; height: 100%; padding: 10px; text-align: center; font-size: 12px; gap: 6px; align-content: center; color: var(--pod); }
.tile .audio .ic { width: 30px; height: 30px; }
.tile .audio span { color: var(--muted); word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .pos { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.tile .kind { position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.tile .tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.tile:hover .tools, .tile:focus-within .tools { opacity: 1; }
.tile .tools button { width: 26px; height: 26px; border-radius: 6px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tile .tools button .ic { width: 14px; height: 14px; }

.plat { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.plat-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; }
.plat-head input { display: none; }
.plat-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.plat-ic .ic { width: 20px; height: 20px; }
.plat-head .txt { flex: 1; min-width: 0; }
.plat-head .txt b { display: block; }
.plat-head .txt small { font-size: 12.5px; }
.switch { width: 40px; height: 23px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.plat.on .switch { background: var(--accent); }
.plat.on .switch::after { transform: translateX(17px); }
.plat-body { display: none; padding: 4px 16px 6px; border-top: 1px solid var(--line); padding-top: 16px; }
.plat.on .plat-body { display: block; }
.plat.locked .plat-head { cursor: default; }
.plat.locked .switch { display: none; }

.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.quick button { font-size: 12.5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.actions { display: grid; gap: 8px; }
.actions .row > .btn { flex: 1; }
.issues { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 13.5px; }
.issues li { display: flex; gap: 8px; align-items: flex-start; }
.issues .ic { width: 16px; height: 16px; margin-top: 2px; }
.issues .err { color: var(--st-failed); }
.issues .warn { color: var(--st-partial); }
.issues .ok { color: var(--st-published); }
.result { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: 0; }
.result .err { grid-column: 1 / -1; font-size: 13px; color: var(--st-failed); background: color-mix(in srgb, var(--st-failed) 9%, transparent); padding: 8px 10px; border-radius: 6px; }
.logs { list-style: none; padding: 0; margin: 0; font-size: 12.5px; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.logs li { display: grid; gap: 1px; padding-left: 10px; border-left: 2px solid var(--line-strong); }
.logs li.error { border-color: var(--st-failed); }
.logs li.success { border-color: var(--st-published); }
.logs li.warn { border-color: var(--st-partial); }
.logs time { color: var(--muted); font-size: 11.5px; }
.when-label { font-family: var(--serif); font-size: 18px; margin-bottom: 4px; }

/* ---------- Configurações ---------- */
.settings { display: grid; gap: 16px; max-width: 760px; }
.settings .card + .card { margin-top: 0; }
.card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.card-head .badge { margin-left: auto; }
details.help { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
details.help summary { cursor: pointer; font-weight: 600; }
details.help ol { padding-left: 20px; margin: 10px 0 4px; }
details.help li { margin-bottom: 6px; }
details.help code, .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; word-break: break-all; }
.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.cover { width: 110px; height: 110px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--line); }

table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 10px 8px; border-bottom: 1px solid var(--line); }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy);
  background-image: radial-gradient(ellipse at center, rgba(19,30,69,.82) 0%, rgba(19,30,69,.94) 70%), url("/brand/padrao.png");
  background-size: cover, cover; background-position: center;
}
.auth .card { width: min(420px, 100%); padding: 30px 30px 26px; border: 0; border-top: 4px solid var(--brand-gold); background: var(--brand-cream); color: var(--navy); }
.auth .card .field > span { color: var(--navy); }
.auth .card input { background: #fffdf7; color: var(--navy); border-color: #d3c7a6; }
.auth .card .btn.primary { background: var(--navy); border-color: var(--navy); color: var(--brand-cream); }
.auth .logo { display: block; width: 230px; margin: 0 auto 4px; }
.auth .kicker { text-align: center; color: #8a733c; display: block; margin: 6px 0 4px; }
.auth .ornament { margin: 8px auto 16px; }
.auth p { text-align: center; color: #5d6585; margin: 0 0 20px; }
.auth .lema { display: block; width: 130px; margin: 22px auto 0; opacity: .9; }

/* ---------- Modal e toast ---------- */
#modal { position: fixed; inset: 0; background: rgba(20, 12, 8, .5); display: grid; place-items: center; padding: 20px; z-index: 50; }
#modal[hidden] { display: none; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(760px, 100%); max-height: 85vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .body { padding: 16px 20px; overflow: auto; }
.modal .media-grid { margin-top: 0; }
.modal .tile { cursor: pointer; }
.modal .tile.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow); white-space: pre-line; animation: in .2s ease-out; }
.toast.error { background: var(--st-failed); color: #fff; }
.toast.success { background: var(--st-published); color: #fff; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 1fr; }
  /* Em telas menores a prévia vira uma gaveta lateral, aberta pelo botão "Prévia" */
  .editor-side { position: fixed; top: 0; right: 0; bottom: 0; z-index: 48; width: min(400px, 94vw); max-height: none;
    padding: 14px; background: var(--bg); box-shadow: -10px 0 30px rgba(0,0,0,.18); transform: translateX(105%); transition: transform .22s ease; }
  .editor.show-preview .editor-side { transform: none; }
  .side-close { display: flex; justify-content: flex-end; align-items: center; padding: 0 2px; margin-bottom: -6px; }
  .side-close b { display: none; }
  .ab-pv { display: inline-flex !important; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 16px 16px 96px; }
  h1 { font-size: 23px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; text-decoration: none; color: var(--muted); padding: 4px; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.new .ic { background: var(--accent); color: var(--accent-ink); border-radius: 10px; width: 36px; height: 28px; padding: 4px 9px; }
  .page-head .hide-m { display: none; }
  .day { min-height: 54px; padding: 4px 2px; }
  .day-head { justify-content: center; margin-bottom: 2px; }
  .day .add, .chips { display: none; }
  .dots { display: flex; }
  .cal-week div { padding: 8px 0; text-align: center; font-size: 11px; }
  .pcard { grid-template-columns: 52px 1fr; gap: 12px; }
  .pcard .thumb { width: 52px; height: 52px; }
  .pcard .badges { grid-column: 1 / -1; justify-content: flex-start; }
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .media-grid { grid-template-columns: repeat(3, 1fr); }
  .tile .tools { opacity: 1; }
  .actionbar { margin: 18px -16px -96px; padding: 10px 16px; bottom: calc(60px + env(safe-area-inset-bottom)); }
  .actionbar { gap: 8px; }
  .ab-when, .ab-actions { width: 100%; flex-wrap: nowrap; }
  .ab-actions { margin-left: 0; gap: 6px; }
  .ab-actions .btn { flex: 1 1 auto; padding: 9px 6px; font-size: 13.5px; gap: 5px; }
  .ab-actions .btn.icon { flex: 0 0 auto; padding: 8px; }
  .ab-actions #dup { display: none; }
  .ab-when .quick, .ab-warn { display: none; }
  .ab-date { flex: 1 1 auto; min-width: 0; }
  .ab-date input { width: 100%; }
  .lg { display: none; }
  .ab-pv { padding: 8px 10px; }
}

/* ---------- Identidade: extras ---------- */
.lead { margin: 0 0 16px; }
.connected { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--st-published) 9%, transparent); border-left: 3px solid var(--st-published); }
.connected small { display: block; }
details.help.advanced { margin: 18px 0 0; }
.card h2 { position: relative; }
.settings .card { border-top: 3px solid var(--gold-line); }
.page-foot { display: none; justify-content: center; padding: 40px 0 0; opacity: .75; }
.page-foot img { width: 110px; }
.page-foot .dark { display: none; }
@media (prefers-color-scheme: dark) {
  .page-foot .light { display: none; }
  .page-foot .dark { display: block; }
}
@media (max-width: 760px) {
  .tabbar { background: var(--side-bg); border-top: 1px solid rgba(199,176,119,.4); }
  .tabbar a { color: var(--side-muted); }
  .tabbar a.active { color: var(--brand-gold); }
  .tabbar a.new .ic { background: var(--brand-gold); color: var(--navy); }
  .mtop { display: flex !important; }
  .page-foot { display: flex; }
  h1 { font-size: 24px; }
}
.mtop { display: none; align-items: center; gap: 10px; margin: -16px -16px 18px; padding: 12px 16px; background: var(--side-bg); color: var(--side-ink); border-bottom: 2px solid var(--brand-gold); }
.mtop img { width: 26px; height: auto; }
.mtop b { font-family: var(--title); font-weight: 400; text-transform: uppercase; letter-spacing: .05em; font-size: 17px; line-height: 1; }
.mtop small { display: block; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-gold); font-weight: 700; }
.page-head h1::after {
  content: ""; display: block; width: 150px; height: 9px; margin-top: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 9'%3E%3Cpath d='M4.5 0 9 4.5 4.5 9 0 4.5zM145.5 0 150 4.5 145.5 9 141 4.5z' fill='%23c7b077'/%3E%3Cpath d='M12 4.5h126' stroke='%23c7b077' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat;
}
.connect-box { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 22px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 14px; }
.connect-box p { margin: 0; max-width: 420px; }
.btn.big { padding: 12px 22px; font-size: 15px; }
.btn.big .ic { width: 20px; height: 20px; }
details.setup-note { background: var(--gold-soft); color: var(--ink); }
details.setup-note summary { display: flex; gap: 8px; align-items: center; color: var(--gold); }
details.setup-note p { margin: 8px 0 0; font-size: 13.5px; }

/* ---------- Canva ---------- */
.c-canva { color: #7d2ae8; }
@media (prefers-color-scheme: dark) { .c-canva { color: #a77cf5; } }
.canva-modal { width: min(900px, 100%); height: min(85vh, 780px); }
.canva-modal .body { flex: 1; min-height: 0; }
.canva-modal h2 { display: flex; gap: 8px; align-items: center; }
.canva-search { display: flex; gap: 8px; margin-bottom: 16px; }
.canva-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.canva-item { display: grid; gap: 4px; text-align: left; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.canva-item:hover { border-color: var(--line-strong); }
.canva-item.picked { outline: 3px solid var(--gold-line); outline-offset: -1px; }
.canva-item b { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.canva-item small { font-size: 12px; }
.cthumb { aspect-ratio: 4 / 5; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.cthumb img { width: 100%; height: 100%; object-fit: cover; }
.canva-modal footer { flex-wrap: wrap; align-items: center; }
.canva-modal footer .seg { margin: 0; }

/* ---------- Pré-visualização ---------- */
.preview-card { padding: 16px; }
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pv-head h2 { margin: 0; }
.pv-tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 99px; overflow: hidden; }
.pv-tabs button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.pv-tabs button .ic { width: 14px; height: 14px; }
.pv-tabs button.on { background: var(--navy); color: var(--brand-cream); }
@media (prefers-color-scheme: dark) { .pv-tabs button.on { background: var(--brand-gold); color: var(--navy); } }
.pv-one { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pv-one .ic { width: 14px; height: 14px; }
.pv-stage { display: grid; place-items: center; }
.pv-note { display: block; margin-top: 10px; font-size: 11.5px; text-align: center; }
.pv-empty { display: grid; place-items: center; align-content: center; gap: 6px; height: 100%; min-height: 160px; color: #8b8fa3; background: #f0f0f0; text-align: center; padding: 16px; }
.pv-empty .ic { width: 30px; height: 30px; }
.pv-empty.small { min-height: 60px; border-radius: 8px; }
.tag { color: #00376b; }

/* telefone (sempre claro, como o app) */
.phone { width: 100%; max-width: 300px; background: #fff; color: #0c0c0c; border-radius: 22px; overflow: hidden; border: 1px solid #ddd; box-shadow: 0 8px 24px rgba(0,0,0,.12); font: 13px/1.35 -apple-system, "Segoe UI", Roboto, sans-serif; position: relative; }
.phone .av { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; background: #fff; border: 1px solid #e4e4e4; padding: 2px; }
.phone .ic { width: 22px; height: 22px; }
.ig-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.ig-head b { flex: 1; font-size: 13px; }
.ig-head .ic { width: 18px; height: 18px; }
.ig-media { position: relative; background: #000; overflow: hidden; }
.ig-media .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ig-media .track::-webkit-scrollbar { display: none; }
.ig-media .slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; position: relative; cursor: pointer; }
.ig-media img, .ig-media video { width: 100%; height: 100%; object-fit: cover; }
.ig-media .count { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.ig-media .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: #222; display: grid; place-items: center; cursor: pointer; padding: 0; }
.ig-media .nav .ic { width: 16px; height: 16px; }
.ig-media .prev { left: 8px; } .ig-media .next { right: 8px; }
.vbadge { position: absolute; top: 10px; left: 10px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.vbadge .ic { width: 18px; height: 18px; }
.ig-actions { display: flex; align-items: center; gap: 12px; padding: 8px 10px 4px; }
.ig-actions .dots-row { flex: 1; display: flex; justify-content: center; gap: 4px; margin-right: 46px; }
.dots-row i { width: 6px; height: 6px; border-radius: 50%; background: #c7c7c7; }
.dots-row i.on { background: #0095f6; }
.ig-cap { padding: 0 10px; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { display: block; }
.phone .more { border: 0; background: none; color: #737373; padding: 0 10px; font: inherit; cursor: pointer; }
.ig-time { display: block; padding: 4px 10px 12px; color: #737373; font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em; }

.phone.tall { aspect-ratio: 9 / 16; background: #000; color: #fff; }
.phone.tall > img, .phone.tall > video, .phone.tall > .pv-empty { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel-side { position: absolute; right: 8px; bottom: 90px; display: grid; gap: 16px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.reel-info { position: absolute; left: 0; right: 44px; bottom: 0; padding: 40px 10px 14px; background: linear-gradient(transparent, rgba(0,0,0,.6)); display: grid; gap: 6px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.reel-info .who, .story-top .who { display: flex; align-items: center; gap: 8px; }
.reel-info .follow { border: 1px solid rgba(255,255,255,.8); border-radius: 6px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; }
.reel-info .tag, .story .tag { color: #fff; font-weight: 600; }
.phone .sound { position: absolute; top: 10px; right: 10px; border: 0; background: rgba(0,0,0,.5); color: #fff; border-radius: 99px; width: 30px; height: 30px; cursor: pointer; }
.story-top { position: absolute; top: 0; left: 0; right: 0; padding: 8px 10px; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.story-top .bars { display: flex; gap: 3px; margin-bottom: 8px; }
.story-top .bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.9); }
.story-top small { opacity: .8; }
.story-reply { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; gap: 12px; align-items: center; }
.story-reply > span:first-child { flex: 1; border: 1px solid rgba(255,255,255,.7); border-radius: 99px; padding: 7px 12px; font-size: 12px; }

.yt { width: 100%; background: #fff; color: #0f0f0f; border-radius: 12px; overflow: hidden; border: 1px solid #ddd; font: 13px/1.4 Roboto, -apple-system, "Segoe UI", sans-serif; }
.yt-player { aspect-ratio: 16 / 9; background: #000; }
.yt-player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.yt-title { padding: 10px 12px 6px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.yt-channel { display: flex; align-items: center; gap: 8px; padding: 2px 12px 8px; }
.yt-channel .av { width: 32px; height: 32px; border-radius: 50%; object-fit: contain; border: 1px solid #e5e5e5; padding: 2px; }
.yt-channel div { flex: 1; min-width: 0; display: grid; }
.yt-channel small { color: #606060; font-size: 11.5px; }
.yt-channel .sub { background: #0f0f0f; color: #fff; border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 600; }
.yt-desc { margin: 0 12px 12px; background: #f2f2f2; border-radius: 10px; border: solid #f2f2f2; border-width: 8px 10px; padding: 0; font-size: 12.5px; line-height: 18px; -webkit-line-clamp: 3; }
.yt .tag { color: #065fd4; }

.pod { width: 100%; background: #121212; color: #fff; border-radius: 14px; padding: 16px; display: grid; gap: 12px; font: 13px/1.4 -apple-system, "Segoe UI", sans-serif; }
.pod-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #282828; }
.pod-meta { display: grid; gap: 2px; }
.pod-meta b { font-size: 16px; }
.pod-meta small { color: #b3b3b3; }
.pod audio { width: 100%; }
.pod-desc { color: #b3b3b3; font-size: 12.5px; -webkit-line-clamp: 3; }
.pod .tag { color: #1ed760; }

/* Canva: seleção de páginas */
.canva-modal .body { scroll-behavior: auto; }
.canva-search input[type=search] { flex: 1; }
.cv-pages-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cv-title { flex: 1; min-width: 160px; display: grid; }
.cv-title b { font-size: 15px; }
.cv-hint { font-size: 12.5px; margin: 0 0 14px; }
.canva-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; align-items: start; }
.cv-page { position: relative; display: grid; gap: 4px; padding: 6px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: center; opacity: .55; transition: opacity .12s, border-color .12s; }
.cv-page.picked { opacity: 1; border-color: var(--gold-line); }
.cv-page:hover { opacity: .9; }
.pthumb { display: grid; place-items: center; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pnum { font-family: var(--serif); font-size: 28px; color: var(--muted); }
.pcheck { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.9); color: transparent; border: 1.5px solid var(--line-strong); }
.pcheck .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.cv-page.picked .pcheck { background: var(--gold-line); border-color: var(--gold-line); color: var(--navy); }
.cv-page small { font-size: 12px; color: var(--muted); }

/* ---------- Biblioteca ---------- */
.lib-stats { margin: -12px 0 14px; font-size: 13.5px; }
.lib-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--gold-soft); border-left: 3px solid var(--gold-line); position: sticky; top: 8px; z-index: 5; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.lib-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.lib-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.lib-item.picked { outline: 3px solid var(--gold-line); outline-offset: -2px; }
.lib-thumb { position: relative; aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; }
.lib-thumb img, .lib-thumb video { width: 100%; height: 100%; object-fit: cover; }
.lib-thumb .audio { color: var(--pod); }
.lib-thumb .audio .ic { width: 40px; height: 40px; }
.lib-check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: rgba(255,255,255,.92); border: 1.5px solid var(--line-strong); color: transparent; }
.lib-check .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.lib-selecting .lib-check { display: grid; }
.lib-item.picked .lib-check { background: var(--gold-line); border-color: var(--gold-line); color: var(--navy); }
.lib-meta { padding: 9px 10px 11px; display: grid; gap: 3px; }
.lib-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta small { font-size: 11.5px; }
.lib-meta .badge { justify-self: start; font-size: 11px; padding: 2px 8px; }
.media-detail { width: min(820px, 100%); }
.md-view { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--radius-sm); min-height: 200px; margin-bottom: 16px; overflow: hidden; }
.md-view img, .md-view video { max-height: 52vh; width: auto; max-width: 100%; }
.md-view audio { width: 90%; margin: 40px 0; }
.md-info { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.md-info dt { color: var(--muted); font-weight: 600; }
.md-info dd { margin: 0; }
.modal .tile .tools { opacity: 0; }
.modal .tile:hover .tools { opacity: 1; }
@media (max-width: 760px) { .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .modal .tile .tools { opacity: 1; } }

/* ---------- Páginas públicas (pedidos das pastorais) ---------- */
body.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-top { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--navy); color: var(--brand-cream); border-bottom: 3px solid var(--brand-gold);
  background-image: linear-gradient(90deg, rgba(19,30,69,.96), rgba(19,30,69,.85)), url("/brand/padrao.png"); background-size: cover, 900px auto; }
.pub-top img { width: 34px; height: auto; }
.pub-top b { display: block; font-family: var(--serif); font-size: 18px; }
.pub-top .kicker { color: var(--brand-gold); font-size: 10.5px; }
.pub-main { width: min(760px, 100%); margin: 0 auto; padding: 26px 16px 30px; flex: 1; }
.pub-hero { text-align: center; margin-bottom: 20px; }
.pub-hero h1 { font-size: 32px; }
.pub-hero .ornament { margin: 10px auto 14px; }
.pub-hero p { max-width: 560px; margin: 0 auto 8px; }
.pub-note { color: var(--muted); font-size: 14px; }
.pub-note.small { font-size: 12.5px; margin: 6px 0 0; }
.pub-warn { color: var(--st-partial); font-weight: 600; font-size: 13.5px; margin: -6px 0 12px; }
.pub-card { padding: 24px; }
.pub-card + .pub-card { margin-top: 16px; }
.pub-sec + .pub-sec { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.pub-sec h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.pub-sec h2 .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--brand-cream); font-family: var(--font); font-size: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.type-card { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 16px 10px; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card .tc-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--navy); }
.type-card .tc-ic .ic { width: 24px; height: 24px; }
.type-card b { font-size: 14px; }
.type-card:has(input:checked) { border-color: var(--gold-line); background: var(--gold-soft); }
.type-card:has(input:checked) .tc-ic { background: var(--navy); color: var(--brand-gold); }
.type-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
@media (prefers-color-scheme: dark) { .type-card .tc-ic { color: var(--brand-gold); } }
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-pick label { cursor: pointer; }
.chips-pick input { position: absolute; opacity: 0; }
.chips-pick span { display: inline-block; padding: 7px 13px; border-radius: 99px; border: 1.5px solid var(--line-strong); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.chips-pick input:checked + span { background: var(--navy); border-color: var(--navy); color: var(--brand-cream); }
.chips-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.drop.small { padding: 14px; grid-auto-flow: column; justify-content: center; gap: 8px; }
.file-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px; }
.file-list li span:not(.ic) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: grid; }
.pub-done { text-align: center; }
.done-ic { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--st-published); color: #fff; }
.done-ic .ic { width: 34px; height: 34px; stroke-width: 2.4; }
.pub-done p { max-width: 520px; margin: 10px auto 18px; }
.trk-title { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 26px; margin: 6px 0 4px; font-weight: 700; }
.trk-steps { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 0; margin: 22px 0 18px; counter-reset: s; }
.trk-steps li { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--muted); position: relative; }
.trk-steps li::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--line-strong); z-index: 0; }
.trk-steps li:first-child::before { display: none; }
.trk-steps li.done::before, .trk-steps li.now::before { background: var(--gold-line); }
.trk-steps i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); position: relative; z-index: 1; }
.trk-steps i .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.trk-steps li.done i { background: var(--gold-line); border-color: var(--gold-line); color: var(--navy); }
.trk-steps li.now i { border-color: var(--navy); box-shadow: 0 0 0 4px var(--gold-soft); background: var(--navy); }
.trk-steps li.now span { color: var(--ink); font-weight: 700; }
.trk-refused { margin: 18px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--st-failed) 10%, transparent); color: var(--st-failed); }
.trk-info { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.trk-info dt { color: var(--muted); font-weight: 600; }
.trk-info dd { margin: 0; }
.pre { white-space: pre-wrap; }
.trk-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.trk-files img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.trk-file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; text-decoration: none; max-width: 220px; }
.trk-file span:not(.ic) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.chat li { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 14px; }
.chat li b { display: block; font-size: 12px; margin-bottom: 2px; }
.chat li p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat li time { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.chat li.them { background: var(--surface-2); border-bottom-left-radius: 4px; justify-self: start; }
.chat li.me { background: var(--gold-soft); border-bottom-right-radius: 4px; justify-self: end; }
.chat li.sys { max-width: none; justify-self: center; padding: 0; font-size: 12px; color: var(--muted); }
.chat li.sys span { background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { min-height: 46px; flex: 1; }
.pub-foot { display: flex; justify-content: center; padding: 16px 0 28px; }
.pub-foot img { width: 110px; opacity: .8; }
.pub-foot .dark { display: none; }
@media (prefers-color-scheme: dark) { .pub-foot .light { display: none; } .pub-foot .dark { display: block; } }
@media (max-width: 600px) {
  .pub-card { padding: 18px 16px; }
  .pub-hero h1 { font-size: 26px; }
  .type-pick { grid-template-columns: 1fr 1fr; }
  .trk-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); font-size: 10.5px; }
  .trk-steps li { font-size: 10.5px; }
  .trk-info { grid-template-columns: 1fr; gap: 2px; }
  .trk-info dd { margin-bottom: 8px; }
  .chat li { max-width: 92%; }
}

/* ---------- Navegação: badge e menu móvel ---------- */
.nav a > span:not(.ic) { flex: 1; }
.nav-badge { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #e05a4f; color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.tabbar a.has-badge { position: relative; }
.tabbar .nav-badge { position: absolute; top: 0; right: calc(50% - 22px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
.sheet { position: fixed; inset: 0; z-index: 55; background: rgba(10, 14, 30, .45); display: flex; align-items: flex-end; }
.sheet-panel { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 16px 12px calc(76px + env(safe-area-inset-bottom)); display: grid; gap: 2px; box-shadow: 0 -10px 30px rgba(0,0,0,.2); }
.sheet-head { padding: 4px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head b { display: block; }
.sheet-panel a { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; }
.sheet-panel a.active { background: var(--accent-soft); }
.sheet-panel .btn { justify-content: flex-start; padding: 12px; }
.pill { font-style: normal; background: #e05a4f; color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11.5px; margin-left: 4px; }
.filters a.active .pill { background: var(--brand-gold); color: var(--navy); }

/* ---------- Quadro ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; scroll-snap-type: x proximity; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; scroll-snap-align: start; min-height: 120px; }
.kcol > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.kcol > header b { font-size: 14px; }
.kcount { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border-radius: 99px; padding: 1px 8px; }
.kcol > header .btn { margin-left: auto; }
.kcol[data-col="delivered"] { opacity: .85; }
.klist { display: grid; gap: 8px; min-height: 60px; border-radius: var(--radius-sm); transition: background .15s; align-content: start; }
.klist.over { background: color-mix(in srgb, var(--gold-line) 14%, transparent); }
.kgap { height: 6px; border-radius: 3px; background: var(--gold-line); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 11px; cursor: grab; display: grid; gap: 6px; box-shadow: 0 1px 2px rgba(19,30,69,.05); }
.kcard:hover { border-color: var(--line-strong); }
.kcard:focus-visible { outline: 2px solid var(--gold-line); }
.kcard.dragging { opacity: .4; }
.kcard.prio-alta { border-left-color: var(--st-failed); }
.kcard.prio-baixa { border-left-color: var(--line); }
.kcard.prio-normal { border-left-color: var(--gold-line); }
.kreq { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.kreq .ic { width: 13px; height: 13px; }
.ktitle { font-size: 14px; line-height: 1.35; }
.kmeta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.kmeta .ic { width: 13px; height: 13px; }
.kdue, .kchk { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; font-size: 12px; color: var(--muted); }
.kdue.soon { color: var(--st-partial); }
.kdue.late { color: var(--st-failed); }
.kchk.ok { color: var(--st-published); }
.kpost { color: var(--st); display: inline-flex; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--navy); color: var(--brand-cream); font-size: 11px; font-weight: 700; flex: none; }
@media (prefers-color-scheme: dark) { .avatar { background: var(--brand-gold); color: var(--navy); } }
.board-hint { font-size: 12.5px; margin-top: 10px; }
.task-modal { width: min(720px, 100%); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.checklist { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.checklist li:hover { background: var(--surface-2); }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }
.task-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); margin-top: 10px; text-decoration: none; }
.task-link span:not(.ic) { flex: 1; font-size: 13.5px; }

/* ---------- Demandas ---------- */
.rrow { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px 12px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.rrow:hover { border-color: var(--line-strong); }
.rrow.unread { border-left: 3px solid #e05a4f; }
.rrow .title { font-weight: 600; display: flex; gap: 8px; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #e05a4f; flex: none; }
.rrow .meta { font-size: 13px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.rtype { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.rtype .ic { width: 22px; height: 22px; }
.rtype.big { width: 52px; height: 52px; }
.req-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.req-layout .card + .card { margin-top: 16px; }
.req-side { position: sticky; top: 16px; }
.req-side .card + .card { margin-top: 16px; }
.req-who { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.req-who b { display: block; }
.refuse { margin-top: 14px; }
.refuse summary { cursor: pointer; color: var(--st-failed); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
@media (max-width: 1080px) { .req-layout { grid-template-columns: 1fr; } .req-side { position: static; } }
@media (max-width: 760px) {
  .board { grid-auto-columns: 84vw; margin: 0 -16px; padding: 0 16px 8px; scroll-snap-type: x mandatory; }
  .grid3 { grid-template-columns: 1fr; }
  .rrow { grid-template-columns: 40px 1fr; }
  .rrow .badges { grid-column: 1 / -1; justify-content: flex-start; }
  .page-head .row { width: 100%; }
}
