/* Pauta: estilos do painel.
   Conceito: a mesa de uma redação. Títulos em tipografia editorial, tinta azul-petróleo,
   estados como carimbos, e a faixa "Na redação agora" mostrando o trabalho em andamento. */
:root {
  --bg: #f3f4f1; --paper: #ffffff; --ink: #17202a; --muted: #5d6873; --line: #dfe3e1; --line-strong: #c9cfcc;
  --accent: #0e6b70; --accent-2: #0a5357; --accent-soft: #e2f0ef; --accent-ink: #ffffff;
  --ok: #17784a; --warn: #9a5b00; --err: #b3261e; --live: #d9480f;
  --ok-bg: #e5f3eb; --warn-bg: #fdf1dc; --err-bg: #fbe6e4; --live-bg: #fde9df; --tag-bg: #eceeec;
  --card: var(--paper);
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(23, 32, 42, .05), 0 6px 18px -10px rgba(23, 32, 42, .18);
  --f-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101518; --paper: #182025; --ink: #e6ebee; --muted: #98a5ae; --line: #27323a; --line-strong: #364450;
    --accent: #5cc2c0; --accent-2: #7fd6d3; --accent-soft: #163233; --accent-ink: #062022;
    --ok: #63d196; --warn: #f0b955; --err: #ff8f85; --live: #ff8a55;
    --ok-bg: #153024; --warn-bg: #352a12; --err-bg: #3c1f1c; --live-bg: #3a2216; --tag-bg: #222c33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
@font-face { font-family: "Inter"; src: url(/static/fonts/inter-var.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(/static/fonts/fraunces-var.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
* { box-sizing: border-box; }
html { font: 15px/1.55 var(--f-body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; }
h1, h2, h3 { text-wrap: balance; }
h1 { font: 600 2rem/1.15 var(--f-display); letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; font-variation-settings: "opsz" 72; }
h2 { font: 600 1.25rem/1.25 var(--f-display); margin: 34px 0 12px; letter-spacing: -.01em; font-variation-settings: "opsz" 36; }
h3 { font-size: 1rem; margin: 0 0 12px; }
code { font: .86em var(--f-mono); background: var(--tag-bg); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.eyebrow { font: 600 .72rem/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }

/* Topo */
.top { display: flex; align-items: center; gap: 22px; padding: 0 max(20px, env(safe-area-inset-left, 0px)); height: 60px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 700 1.3rem/1 var(--f-display); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  font: 700 1rem/1 var(--f-display); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top nav a { position: relative; padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; transition: color .15s, background .15s; }
.top nav a:hover { color: var(--ink); background: var(--tag-bg); text-decoration: none; }
.top nav a.on { color: var(--ink); font-weight: 650; }
.top nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -11px; height: 2px; border-radius: 2px; background: var(--accent); }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.who { color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) { .who { display: none; } .top { gap: 10px; } .top nav a.on::after { bottom: -9px; } }

.wrap { max-width: 1200px; margin: 0 auto; padding-block: 30px 72px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head > div { min-width: 0; }
.meta { color: var(--muted); margin: -8px 0 18px; }

/* Superfícies */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child { margin-top: 0; }
.narrow { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid2.wide-left { grid-template-columns: 3fr 2fr; }
.grid2 > * { min-width: 0; }
@media (max-width: 900px) { .grid2, .grid2.wide-left { grid-template-columns: 1fr; } }

/* Formulários */
.form, fieldset { display: grid; gap: 16px; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 18px 0 0; margin: 0; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font: 600 1.05rem/1.2 var(--f-display); padding: 0 8px 0 0; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; min-width: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[readonly] { background: var(--bg); font-family: var(--f-mono); font-size: .84rem; }
textarea { resize: vertical; line-height: 1.5; }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; flex-wrap: wrap; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.weekdays .check { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 999px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.buttons form, .actions form, .inline { margin: 0; display: inline; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .88rem; min-height: 36px; padding: 6px 13px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s; }
.btn:hover { border-color: var(--muted); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.link { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 6px; }

/* Tabelas */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
.tablewrap > table { min-width: 760px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font: 600 .72rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; background: color-mix(in srgb, var(--bg) 55%, var(--paper)); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tbody tr:last-child > * { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
td.actions { flex-wrap: nowrap; }
td.actions .btn { min-height: 32px; padding: 4px 10px; font-size: .82rem; }
.campaign-name { font-weight: 650; font-size: 1rem; }
.campaign-topic { display: block; color: var(--muted); font-size: .86rem; max-width: 42ch; }
table.plain th, table.plain td { padding: 6px 8px 6px 0; }
table.plain tbody th { font-weight: 400; }
table.plain tbody tr:hover { background: none; }
.numcell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.barcell { width: 40%; }
progress { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 5px; background: var(--tag-bg); overflow: hidden; vertical-align: middle; }
progress::-webkit-progress-bar { background: var(--tag-bg); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--accent); }
tr.drop progress::-webkit-progress-value { background: var(--err); }
tr.drop progress::-moz-progress-bar { background: var(--err); }
.droptag { color: var(--err); font-weight: 600; }

/* Estados como carimbos */
.tag { display: inline-flex; align-items: center; gap: 6px; font: 650 .72rem/1 var(--f-body); letter-spacing: .03em; padding: 5px 9px; border-radius: 999px; background: var(--tag-bg); color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag.active, .tag.published, .tag.succeeded { background: var(--ok-bg); color: var(--ok); }
.tag.failed { background: var(--err-bg); color: var(--err); }
.tag.queued { background: var(--warn-bg); color: var(--warn); }
.tag.running { background: var(--live-bg); color: var(--live); }
.tag.running::before { animation: pulse 1.4s ease-out infinite; }

/* Avisos */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 18px; background: var(--tag-bg); overflow-wrap: anywhere; border: 1px solid transparent; animation: rise .35s ease-out both; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.flash a { color: inherit; text-decoration: underline; }
.errtext { color: var(--err); font-size: .85rem; max-width: 60ch; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 28px; text-align: center; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.approve { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin: 0 0 18px;
  border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.approve > div { min-width: 0; }

/* Números do topo */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat .num { font: 600 2rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: .82rem; }
.stat.hot { border-color: color-mix(in srgb, var(--live) 40%, var(--line)); }
.stat.hot .num { color: var(--live); }
.stat.bad .num { color: var(--err); }
.stat.good .num { color: var(--ok); }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.filters label { min-width: 160px; }

/* Na redação agora */
.newsroom { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.newsroom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--live) 9%, transparent), transparent 55%); flex-wrap: wrap; }
.newsroom-head h2 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.onair { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); position: relative; flex: 0 0 auto; }
.newsroom.busy .onair { background: var(--live); }
.newsroom.busy .onair::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--live); animation: ring 1.6s ease-out infinite; }
.writer-chip { font: 600 .74rem/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 999px; }
.desk { list-style: none; margin: 0; padding: 6px; display: grid; gap: 4px; }
.desk li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 12px 10px; border-radius: 8px; animation: rise .3s ease-out both; }
.desk li.running .clock { color: var(--live); }
.desk li + li { border-top: 1px dashed var(--line); border-radius: 0; }
.desk .who { display: block; color: var(--ink); font-weight: 650; font-size: .95rem; }
.desk .what { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; min-width: 0; }
.desk .what span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk .clock { font: 500 .95rem/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.desk .lane { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: var(--tag-bg); overflow: hidden; }
.desk .lane i { display: block; height: 100%; width: 35%; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--live), transparent); animation: sweep 1.8s ease-in-out infinite; }
.desk li.queued .lane i { background: var(--line-strong); animation: none; width: 100%; opacity: .4; }
.desk-empty { padding: 22px 18px; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.desk-empty::before { content: ""; width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; background:
  conic-gradient(from 0deg, var(--accent-soft), var(--accent), var(--accent-soft)); -webkit-mask: radial-gradient(circle, transparent 55%, #000 57%); mask: radial-gradient(circle, transparent 55%, #000 57%); opacity: .6; }

.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; }
.code, pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; font: .84rem/1.55 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.codes { columns: 2; max-width: 320px; }
.qr { display: block; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview { width: 100%; height: 680px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin: 8px 0 12px; box-shadow: var(--shadow); }
.sources, .facts { padding-left: 20px; display: grid; gap: 6px; margin: 0 0 12px; overflow-wrap: anywhere; }
.facts { font-size: .9rem; max-height: 520px; overflow-y: auto; }
.facts .src { font-size: .8rem; white-space: nowrap; }
.insights { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.sev { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; margin-right: 6px; background: var(--warn-bg); color: var(--warn); }
.sev3 { background: var(--err-bg); color: var(--err); }
canvas#heat { max-width: 100%; height: auto; border-radius: 8px; display: block; }
details { margin: 0 0 12px; }
summary { cursor: pointer; font-weight: 600; }
details.card > summary { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { margin-bottom: 12px; }

/* Movimento */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes sweep { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
@keyframes rise { from { transform: translateY(6px); opacity: .001; } to { transform: none; opacity: 1; } }
main.wrap > * { animation: rise .4s ease-out both; }
main.wrap > *:nth-child(2) { animation-delay: .04s; }
main.wrap > *:nth-child(3) { animation-delay: .08s; }
main.wrap > *:nth-child(4) { animation-delay: .12s; }
main.wrap > *:nth-child(n+5) { animation-delay: .16s; }
.stat .num.tick { animation: rise .35s ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
