:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #15181c;
  --muted: #5b616b;
  --border: #e2e4e8;
  --teal: #007F65;
  --teal-soft: #e6f4ef;
  --red: #E10B17;
  --red-soft: #fdecec;
  --radius: 14px;
  --font-head: "Barlow", "Segoe UI", Arial, sans-serif;
  --font-body: "Inter", "Segoe UI", Arial, sans-serif;
  --input-bg: #ffffff;
  --dash: #c9cdd3;
  --error-ink: #8f0d12;
  --ok-ink: #00513d;
  --ico-accent: var(--teal);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #1b1f24;
  --ink: #f4f5f6;
  --muted: #a7adb5;
  --border: #2b3038;
  --teal: #007F65;
  --teal-soft: rgba(0, 127, 101, 0.14);
  --red: #ff5a5f;
  --red-soft: rgba(225, 11, 23, 0.16);
  --input-bg: #15181c;
  --dash: #3a404a;
  --error-ink: #ffb3b5;
  --ok-ink: #7fe0c4;
  color-scheme: dark;
}

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

.ico {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  --ico-accent: #E10B17;
  transition: border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--teal); }
.icon-btn .ico { width: 20px; height: 20px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; }
a { color: var(--teal); }
img { display: block; max-width: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 0.95rem/1 var(--font-head);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible { outline: 3px solid rgba(0, 127, 101, 0.35); outline-offset: 2px; }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover:not(:disabled) { filter: brightness(0.9); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn--danger { background: var(--surface); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red); }
.btn--danger:hover:not(:disabled) { background: var(--red-soft); }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 0.92rem; margin: 0 0 16px; }
.alert--error { background: var(--red-soft); color: var(--error-ink); }
.alert--ok { background: var(--teal-soft); color: var(--ok-ink); }
[hidden] { display: none !important; }

/* ===== Login ===== */
.login-tools {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.login {
  position: relative;
  padding-top: 80px !important;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}
.login-card img { height: 56px; width: auto; margin: 0 auto 20px; }
.login-card h1 { font-size: 1.35rem; text-align: center; margin-bottom: 6px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 0.92rem; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.88rem; }
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  background: var(--input-bg);
}
.login-card .btn { width: 100%; margin-top: 6px; padding: 13px; }

/* ===== Painel ===== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner, .page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; font: 700 1rem/1 var(--font-head); }
.topbar-brand img { height: 38px; width: auto; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions form { margin: 0; }

.page { padding-top: 32px; padding-bottom: 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 24px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.card-head h2 { font-size: 1.2rem; margin-bottom: 4px; }
.card-head p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.tpl {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tpl:hover { border-color: var(--muted); }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.tpl:has(input:focus-visible) { outline: 3px solid rgba(0, 127, 101, 0.35); outline-offset: 2px; }
.tpl-name { font: 700 1rem/1.2 var(--font-head); }
.tpl-desc { color: var(--muted); font-size: 0.86rem; }
.tpl-tag {
  justify-self: start;
  margin-top: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font: 700 0.7rem/1.4 var(--font-head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tpl-preview { display: inline-flex; align-items: center; gap: 4px; font-size: 0.86rem; font-weight: 600; margin-top: 6px; justify-self: start; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-text { color: var(--muted); font-size: 0.9rem; }

.video-current { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; margin-bottom: 22px; }
.video-current video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16 / 9; }
.video-meta dl { margin: 0 0 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.9rem; }
.video-meta dt { color: var(--muted); }
.video-meta dd { margin: 0; word-break: break-all; }
.video-empty {
  padding: 22px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  margin-bottom: 22px;
  font-size: 0.92rem;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 30px 20px;
  border: 2px dashed var(--dash);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--teal); background: var(--teal-soft); }
.dropzone strong { font-family: var(--font-head); font-size: 1.02rem; }
.dropzone span { color: var(--muted); font-size: 0.86rem; }
.dropzone input { display: none; }

.progress { margin-top: 16px; }
.progress-bar { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.progress-bar div { height: 100%; width: 0; background: var(--teal); transition: width 0.2s ease; }
.progress-text { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.86rem; color: var(--muted); }

@media (max-width: 760px) {
  .templates { grid-template-columns: 1fr; }
  .video-current { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .card-head { flex-direction: column; }
  .topbar-brand span { display: none; }
}
