/* ============================================================ tokens */
/* Marca Kort: preto quente ~60%, branco 20%, Amarelo Corte 12% (só botões e destaques), ciano e magenta 4% */
:root {
  --bg: #0E0D0B;
  --surface: #1A1916;
  --surface-2: #24221E;
  --surface-3: #2C2A25;
  --line: #34312B;
  --line-strong: #423E36;
  --text: #FFFDF6;
  --muted: #A39E92;
  --faint: #6E6A60;

  --accent: #FFD400;
  --accent-hover: #FFE04D;
  --accent-soft: rgba(255, 212, 0, 0.14);
  --on-accent: #0E0D0B;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #FF9F43;
  --warn-soft: rgba(255, 159, 67, 0.13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.13);

  /* uma cor por ferramenta */
  --kind-cuts: #FFD400;
  --kind-edit: #3EC6FF;
  --kind-animation: #FF2E88;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.25);
  --sidebar: 240px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
/* Títulos das telas: Archivo larga e inclinada, "correndo" como o logo */
h1 { font-size: 30px; font-weight: 900; font-style: italic; font-stretch: 115%; letter-spacing: -0.025em; line-height: 1.05; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ============================================================ layout */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.main { padding: 32px clamp(16px, 4vw, 48px) 80px; max-width: 1240px; width: 100%; min-width: 0; margin: 0 auto; outline: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 22px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.brand-mark { width: 30px; height: 30px; display: block; flex: none; }
.brand-name { font-size: 24px; }

/* Wordmark: duas cópias do nome, a metade da direita deslocada pelo corte diagonal */
.wm { position: relative; display: inline-block; font-family: var(--font); font-weight: 900; font-style: italic; font-stretch: 125%; letter-spacing: -0.03em; line-height: 0.9; }
.wm > span { display: block; }
.wm .a { clip-path: polygon(0 0, 57% 0, 47% 100%, 0 100%); }
.wm .b { position: absolute; inset: 0; clip-path: polygon(57% 0, 100% 0, 100% 100%, 47% 100%); transform: translate(0.035em, -0.05em); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .icon { color: var(--accent); }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}

.sidebar-status { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.status-row { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-row.ok { color: var(--text); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.status-row.ok .status-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ============================================================ page header */
.page-header { margin-bottom: 26px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--text); }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.page-title h1 { overflow-wrap: anywhere; }
.page-title p { margin-top: 4px; max-width: 640px; }
.page-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--accent);
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================ botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: 14px; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 800; box-shadow: 0 6px 18px rgba(255, 212, 0, 0.18); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover:not(:disabled) { border-color: var(--faint); }
.btn.ghost { background: transparent; color: var(--muted); padding: 0 10px; }
.btn.ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: transparent; }
.btn.danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent;
  animation: spin 0.8s linear infinite;
}
.btn.primary.loading::after { border-color: var(--on-accent) transparent var(--on-accent) transparent; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn.danger:hover { color: var(--bad); }

input, textarea, select {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.55; }
textarea { resize: vertical; line-height: 1.5; }
input[type="range"] { padding: 0; height: 36px; accent-color: var(--accent); background: transparent; border: 0; box-shadow: none; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b90a0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.actions.end { justify-content: flex-end; }

.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-bottom: 18px; }
.toggle {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
  font-size: 14px; font-weight: 500;
}
.toggle:hover { border-color: var(--line-strong); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(14px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================ pills, tags, barras */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }

.kind-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.kind-tag.kind-cuts .icon { color: var(--kind-cuts); }
.kind-tag.kind-edit .icon { color: var(--kind-edit); }
.kind-tag.kind-animation .icon { color: var(--kind-animation); }

.bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.6s ease; }

/* ============================================================ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-title { margin-bottom: 16px; }

/* ============================================================ início */
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.tool-card {
  --kc: var(--accent);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.tool-card::before {
  content: ""; position: absolute; inset: auto -40% -60% auto; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--kc) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.tool-card:hover { border-color: color-mix(in srgb, var(--kc) 55%, var(--line)); transform: translateY(-2px); }
.tool-card.kind-cuts { --kc: var(--kind-cuts); }
.tool-card.kind-edit { --kc: var(--kind-edit); }
.tool-card.kind-animation { --kc: var(--kind-animation); }
.tool-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  color: var(--kc); background: color-mix(in srgb, var(--kc) 14%, transparent);
}
.tool-card p { color: var(--muted); font-size: 14px; flex: 1; }
.tool-cta { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--kc); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 34px; }
.stat { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 28px; font-weight: 900; font-style: italic; font-stretch: 115%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.section { margin-bottom: 34px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* ============================================================ grade de projetos */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { position: relative; display: flex; align-items: center; width: min(280px, 100%); }
.search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; height: 38px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.project-card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}
.project-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 10; background: #000; overflow: hidden; position: relative; }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb.placeholder { display: grid; place-items: center; color: var(--faint); background: var(--surface-2); }
.thumb.placeholder.kind-cuts { color: var(--kind-cuts); background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--kind-cuts) 18%, transparent), var(--surface-2) 70%); }
.thumb.placeholder.kind-edit { color: var(--kind-edit); background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--kind-edit) 18%, transparent), var(--surface-2) 70%); }
.thumb.placeholder.kind-animation { color: var(--kind-animation); background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--kind-animation) 18%, transparent), var(--surface-2) 70%); }
.project-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-title { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.project-meta { color: var(--muted); font-size: 13px; }
.project-body .bar { margin-top: 4px; }

.empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 6px; }
.empty p { max-width: 420px; margin-bottom: 8px; }

/* ============================================================ criação */
.create-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 190px; padding: 24px; border-radius: var(--radius); cursor: pointer;
  border: 1.5px dashed var(--line-strong); background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { cursor: progress; border-style: solid; }
.drop-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); margin-bottom: 4px; }
.dropzone .bar { width: min(320px, 100%); margin-top: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.url-row { display: flex; gap: 8px; position: relative; }
.url-row .input-icon { position: absolute; left: 12px; top: 12px; color: var(--muted); pointer-events: none; }
.url-row input { padding-left: 36px; height: 42px; }
.url-row .btn { height: 42px; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.segmented button {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; border: 0;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.segmented.small { margin-bottom: 18px; }
.segmented.small button { height: 32px; font-size: 13px; }
.pane { display: flex; flex-direction: column; gap: 12px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pane textarea { font-family: var(--mono); font-size: 13.5px; min-height: 260px; }
.pane .toggle { align-self: flex-start; }

.tips { font-size: 14px; color: var(--muted); }
.tips summary { cursor: pointer; color: var(--text); font-weight: 600; font-size: 14px; }
.tips ul { margin: 10px 0 0; padding-left: 20px; line-height: 1.8; }
.tips pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 13px; color: var(--text); margin: 10px 0 0; }

/* ============================================================ projeto */
.status-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -10px 0 18px; }
.stats-text { font-size: 14px; color: var(--muted); }
.status-line .stats-text { color: var(--ok); font-weight: 500; }

.stepper { list-style: none; margin: 0 0 22px; padding: 16px 18px; display: flex; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.stepper li { display: flex; align-items: center; gap: 8px; flex: 1; min-width: max-content; color: var(--faint); font-size: 13px; font-weight: 600; }
.stepper li:not(:last-child)::after { content: ""; flex: 1; min-width: 16px; height: 2px; background: var(--line); border-radius: 2px; }
.stepper li.done { color: var(--muted); }
.stepper li.done::after { background: var(--ok); }
.stepper li.current { color: var(--text); }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-3); flex: none; }
.stepper li.done .step-dot { background: var(--ok-soft); color: var(--ok); }
.stepper li.current .step-dot { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-label small { color: var(--accent); font-weight: 700; }

.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px;
  border-radius: var(--radius-sm); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--text);
}
.alert .icon { color: var(--bad); margin-top: 2px; }
.alert p { color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.alert.small { padding: 10px 12px; font-size: 13px; margin: 8px 0; }

.output { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.output-media { position: sticky; top: 24px; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 9; }
.player.vertical { aspect-ratio: 9 / 16; max-height: 78vh; margin: 0 auto; }
.player.square { aspect-ratio: 1; max-height: 78vh; margin: 0 auto; }
.player video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; font-size: 14px; background: var(--surface-2); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }

.panel-title { margin: 22px 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.scenes { display: flex; flex-direction: column; gap: 10px; }
.scene { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.scene-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scene-num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.scene-head select { width: auto; flex: 1 1 auto; min-width: 0; max-width: 220px; height: 36px; padding-top: 6px; padding-bottom: 6px; }
.scene-tools { display: flex; gap: 4px; margin-left: auto; flex: none; }
.scene-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scene-fields .f-title, .scene-fields .f-items { grid-column: 1 / -1; }
.add-scene { margin-top: 10px; align-self: flex-start; }

.channels { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.channel {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 14px;
}
.channel:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.channel input { width: 16px; height: 16px; margin: 0 2px 0 6px; }
.channel img, .channel-fallback { width: 24px; height: 24px; border-radius: 50%; flex: none; }
.channel-fallback { display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 12px; }
.channel small { color: var(--muted); }
.panel > .field { margin-bottom: 14px; }
.scheduled-box { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); }
.scheduled-box strong { color: var(--text); }

/* cortes */
.clips { display: flex; flex-direction: column; gap: 16px; }
.clip { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; padding: 18px; }
.clip.rejected { opacity: 0.55; }
.clip .player.vertical { max-height: 430px; }
.clip-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.score {
  width: 48px; height: 48px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-size: 18px; font-weight: 800; color: var(--kind-cuts); background: color-mix(in srgb, var(--kind-cuts) 14%, transparent);
}
.clip-title { font-size: 16px; overflow-wrap: anywhere; }
.clip-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.reason { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.publish { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 8px; }
.publish .panel-title { margin-top: 14px; }
.publish-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.publish-row .field { flex: 1 1 200px; }
.clip-edit { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.clip-edit summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.clip-edit summary:hover { color: var(--text); }
.clip-edit[open] summary { color: var(--text); margin-bottom: 12px; }
.clip-form { display: flex; flex-direction: column; gap: 12px; }


/* ============================================================ tema e prévia */
.theme-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 128px)); gap: 10px; }
.theme-option { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-width: 0; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  aspect-ratio: 4 / 5; padding: 14% 6% 12%; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid var(--line); transition: border-color 0.15s, transform 0.15s;
}
.theme-option:hover .theme-swatch { border-color: var(--line-strong); }
.theme-option input:checked + .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-option input:focus-visible + .theme-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-option input:checked + .theme-swatch::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-11'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.sw-stat {
  font: 800 clamp(15px, 2.2vw, 22px)/1 Montserrat, var(--font); letter-spacing: -0.03em;
  padding: 4px 8px; border-radius: 8px; border: 1px solid transparent;
}
.sw-caption { display: flex; gap: 3px; align-items: center; font: 900 clamp(8px, 1vw, 11px)/1 Montserrat, var(--font); text-transform: uppercase; color: #fff; }
.sw-caption > span:first-child { -webkit-text-stroke: 2px rgba(0, 0, 0, 0.85); paint-order: stroke; }
.sw-pill { padding: 2px 4px; border-radius: 4px; transform: rotate(-2deg); }
.theme-name { font-size: 13px; font-weight: 600; text-align: center; color: var(--muted); }
.theme-option input:checked ~ .theme-name { color: var(--text); }

.preview { margin-top: 16px; }
.preview-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview-frame {
  position: relative; margin-top: 12px; border-radius: var(--radius-sm); overflow: hidden; background: #000;
  border: 1px solid var(--line); min-height: 160px; display: grid; place-items: center;
}
.preview-frame img { display: block; max-width: 100%; max-height: 460px; }
.preview-frame img:not([src]) { display: none; }
.preview-loading {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(14, 13, 11, 0.6); color: var(--text); font-size: 14px;
}
.preview-frame.loading .preview-loading { display: flex; }

.cuts-visual { padding: 0; margin-bottom: 16px; }
.cuts-visual summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 16px 18px; cursor: pointer; font-weight: 600; }
.cuts-visual summary .hint { font-weight: 400; }
.cuts-visual summary .icon { color: var(--kind-cuts); }
.cuts-visual[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.cuts-visual > :not(summary) { margin-left: 18px; margin-right: 18px; }
.cuts-visual > .actions { margin-bottom: 18px; }
/* ============================================================ agenda */
.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agenda-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s;
}
.agenda-item:hover { border-color: var(--line-strong); }
.agenda-item > .icon { color: var(--faint); margin-left: auto; }
.agenda-time { display: flex; flex-direction: column; min-width: 54px; }
.agenda-time strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.agenda-time small { color: var(--muted); font-size: 12px; }
.agenda-kind { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.agenda-kind.kind-cuts { color: var(--kind-cuts); background: color-mix(in srgb, var(--kind-cuts) 14%, transparent); }
.agenda-kind.kind-edit { color: var(--kind-edit); background: color-mix(in srgb, var(--kind-edit) 14%, transparent); }
.agenda-kind.kind-animation { color: var(--kind-animation); background: color-mix(in srgb, var(--kind-animation) 14%, transparent); }
.agenda-text { display: flex; flex-direction: column; min-width: 0; }
.agenda-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-days { display: flex; flex-direction: column; gap: 26px; }
.agenda-day h2 { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.agenda-day h2::first-letter { text-transform: uppercase; }
.past { margin-top: 30px; }
.past summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

/* ============================================================ toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 14px; animation: toast-in 0.2s ease-out;
}
.toast .icon { margin-top: 2px; }
.toast.success .icon { color: var(--ok); }
.toast.error { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.toast.error .icon { color: var(--bad); }
.toast.info .icon { color: var(--info); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all 0.35s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================ responsivo */
@media (max-width: 1100px) {
  .tools { grid-template-columns: minmax(0, 1fr); }
  .tool-card { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .tool-card h2 { flex: 1; }
  .tool-card p { flex-basis: 100%; order: 3; }
  .create-layout { grid-template-columns: minmax(0, 1fr); }
  .output { grid-template-columns: 1fr; }
  .output-media { position: static; max-width: 420px; width: 100%; margin: 0 auto; }
}

@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  }
  .brand, .sidebar-status { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 0; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 11px; text-align: center; position: relative; }
  .nav-item.active { background: transparent; color: var(--accent); }
  .nav-label { flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  h1 { font-size: 25px; }
  .page-icon { width: 38px; height: 38px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .clip { grid-template-columns: 1fr; }
  .clip .player.vertical { max-width: 280px; width: 100%; }
  .scene-fields { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 16px; left: 16px; max-width: none; }
  .url-row { flex-wrap: wrap; }
  .url-row .btn { width: 100%; }
  .card { padding: 16px; }
}

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

/* ============================================================ marca Kort */
.toggle input:checked + .switch::after { background: var(--on-accent); }
.tool-card h2, .empty h3, .section-head h2 { font-weight: 900; font-style: italic; font-stretch: 112%; letter-spacing: -0.02em; }
.tool-card h2 { font-size: 21px; }
.score, .stepper small, .clip-meta .mono, .project-meta, .dropzone .muted { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.score { font-size: 16px; font-weight: 600; }
.project-meta { font-size: 12px; }
.slogan { margin-top: 6px; font-weight: 800; font-style: italic; font-stretch: 112%; font-size: 17px; color: var(--accent); }
.busy-line { margin: -6px 0 18px; color: var(--muted); font-size: 15px; }
.busy-line .mono { color: var(--text); margin-left: 4px; }
.done-line { color: var(--text); font-weight: 700; }
.alert details { margin-top: 6px; font-size: 13px; color: var(--muted); }
.alert summary { cursor: pointer; }
.alert details p { margin-top: 6px; font-family: var(--mono); font-size: 12px; }

/* ============================================================ login */
.auth-page { min-height: 100vh; }
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand {
  background: var(--accent); color: var(--on-accent); padding: clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; overflow: hidden;
}
.auth-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 600; position: absolute; top: clamp(20px, 4vw, 40px); left: clamp(28px, 5vw, 64px); right: clamp(28px, 5vw, 64px); }
.auth-brand-top img { border-radius: 10px; box-shadow: 0 0 0 2px var(--on-accent); }
.auth-wm { font-size: clamp(72px, 9.5vw, 170px); align-self: flex-start; }
.auth-slogan { font-weight: 900; font-style: italic; font-stretch: 112%; font-size: clamp(22px, 2.6vw, 34px); line-height: 1.05; letter-spacing: -0.02em; }
.auth-sub { font-size: 16px; opacity: 0.75; max-width: 36ch; }
.auth-track { position: relative; display: flex; height: 30px; margin-top: 14px; border: 2px solid var(--on-accent); border-radius: 6px; overflow: hidden; max-width: 520px; }
.auth-track i { flex: var(--w); border-right: 2px solid var(--on-accent); }
.auth-track i:last-of-type { border-right: 0; }
.auth-track .keep { background: var(--on-accent); }
.auth-track .drop { background: repeating-linear-gradient(-45deg, transparent 0 5px, rgba(14, 13, 11, 0.35) 5px 7px); }
.auth-playhead { position: absolute; top: -2px; bottom: -2px; left: 63%; width: 3px; background: var(--kind-animation); }
@media (prefers-reduced-motion: no-preference) {
  .auth-playhead { animation: scrub 7s linear infinite; }
  @keyframes scrub { from { left: 0%; } to { left: 100%; } }
}

.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-loading { display: grid; place-items: center; min-height: 200px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font-size: 36px; }
.auth-lead { margin-top: -6px; font-size: 15px; }
.auth-submit { height: 46px; font-size: 15px; margin-top: 4px; }
.auth-error { color: var(--bad); font-size: 14px; background: var(--bad-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.auth-footer { text-align: center; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
input[readonly] { color: var(--muted); background: var(--surface); }

@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .auth-brand { padding: 72px 20px 24px; gap: 10px; }
  .auth-brand-top { left: 20px; right: 20px; top: 20px; }
  .auth-wm { font-size: clamp(64px, 22vw, 110px); }
  .auth-track { display: none; }
  .auth-main { place-items: start center; padding: 28px 16px 40px; }
}

/* ============================================================ conta e admin */
.account { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.account-box { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.account-box:hover { border-color: var(--line-strong); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-weight: 900; font-style: italic; font-size: 14px;
}
.account-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.account-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-status { margin-top: 0; }

.settings { display: grid; gap: 16px; max-width: 760px; }
.settings .card h2 { margin-bottom: 14px; }
.settings .actions { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td.num { font-family: var(--mono); color: var(--muted); }
.table .who strong { display: block; }
.table .who small { color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.role-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.role-tag.admin { background: var(--accent-soft); color: var(--accent); }
.role-tag.off { background: var(--bad-soft); color: var(--bad); }
.invite-form { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 10px; align-items: end; }
.link-box { display: flex; gap: 8px; margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); flex-wrap: wrap; align-items: center; }
.link-box input { flex: 1 1 260px; font-family: var(--mono); font-size: 12px; background: var(--bg); }
.link-box p { flex-basis: 100%; font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .invite-form { grid-template-columns: minmax(0, 1fr); }
  .account { display: none; }
}
.settings.wide { max-width: 1000px; }
.mobile-only { display: none; }
@media (max-width: 860px) { .mobile-only { display: inline-flex; } }
