:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #22262f;
  --border: #2c313c;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #ff9466;        /* links e destaques — 8,7:1 sobre --bg */
  --accent-strong: #ff7a45; /* fundo de botão primário — 7,3:1 com texto escuro */
  --accent-ink: #131417;    /* texto sobre accent-strong */
  --green: #3fb950;
  --red: #f85149;
  --red-btn: #c93c37;       /* fundo de botão danger — 5,0:1 com texto branco */
  --yellow: #d29922;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
header .brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
header nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
header nav a { color: var(--muted); font-weight: 500; padding: 4px 2px 6px; border-bottom: 2px solid transparent; }
header nav a:hover { color: var(--text); text-decoration: none; }
header nav a.active { color: var(--text); border-bottom-color: var(--accent-strong); }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 17px; margin: 24px 0 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.card .num { font-size: 32px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
}
.badge.manual { background: #1f3a5f; color: #9ec5ff; }
.badge.channel { background: #1f4a2f; color: #9fe0ac; }
.badge.topic { background: #4a3a1f; color: #e0c99f; }
.badge.ok { background: #163a24; color: var(--green); }
.badge.fail { background: #3a1616; color: var(--red); }
.badge.run { background: #3a3216; color: var(--yellow); }

input, textarea, select {
  width: 100%;
  padding: 9px 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
textarea { resize: vertical; min-height: 60px; }
label { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 5px; }

button, .btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 7px;
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
button:hover, .btn:hover { background: var(--accent); text-decoration: none; }
button.secondary, .btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover, .btn.secondary:hover { background: var(--border); }
button.danger, .btn.danger { background: var(--red-btn); color: #fff; }
button.danger:hover, .btn.danger:hover { background: #b62324; }
button.danger.secondary { background: transparent; color: var(--red); border: 1px solid #6b2a27; }
button.danger.secondary:hover { background: #2a1717; }
button.ok { background: var(--green); color: var(--accent-ink); }
button.ok:hover { background: #4bc75f; }
button:disabled { opacity: 0.55; cursor: wait; }
button.loading::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.inline-form { display: inline; }

.grid-clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.clip-card video { width: 100%; border-radius: 8px 8px 0 0; background: #000; display: block; }
.clip-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.clip-card .body { padding: 14px; }
.score { font-weight: 700; color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
/* Toasts (substituem flash/alert/confirm — regra: nunca window.alert/confirm) */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 380px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: toast-in .18s ease-out; }
.toast--ok { border-left-color: var(--green); }
.toast--erro { border-left-color: var(--red); }
.toast--confirm { border-left-color: var(--accent-strong); }
.toast--out { opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }
.toast__msg { display: block; font-size: 14px; color: var(--text); }
.toast__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.toast__actions button { padding: 6px 12px; font-size: 13px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* Diálogos (caixa de configuração — ex.: reagendar publicação) */
dialog.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 20px; max-width: min(92vw, 400px); box-shadow: 0 16px 48px rgba(0,0,0,.5); }
dialog.dialog::backdrop { background: rgba(0,0,0,.55); }
dialog.dialog h3 { margin: 0 0 14px; }
dialog.dialog label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
dialog.dialog input[type="datetime-local"] { display: block; margin-top: 6px; width: 100%; }

.meter { display: block; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--accent-strong); }
.meter.warn > span { background: var(--red); }
.scorebar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-left: 8px; }
.scorebar > span { display: block; height: 100%; border-radius: 3px; background: var(--green); }
pre.log { background: #0b0d11; border: 1px solid var(--border); border-radius: 7px; padding: 12px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; }

@media (max-width: 768px) {
  header { padding: 10px 14px; gap: 14px; }
  header nav { gap: 12px; }
  main { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
