:root {
  color-scheme: light;
  --paper: #ecebf4;
  --sheet: #fbfbfe;
  --ink: #1b1838;
  --muted: #5e5a7d;
  --line: #cfcde0;
  --cobalt: #2337e6;
  --cobalt-deep: #1826a8;
  --ok: #0a7a5c;
  --wait: #8f5400;
  --bad: #c21f45;
  --font: 'Familjen Grotesk', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
}

h1, h2, h3, p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--cobalt); }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.wall :focus-visible { outline-color: #fff; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.demo-banner {
  padding: 0.4rem 1.5rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.875rem;
  text-align: center;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1rem 1.5rem;
}

.top h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

.accounts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

.account {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 0.875rem;
}
.account.expired { border-color: var(--bad); }
.account strong { font-weight: 600; }
.account button {
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.account button:hover { background: var(--paper); color: var(--bad); }
.account a { font-weight: 600; padding-right: 0.5rem; color: var(--bad); }

.connect {
  padding: 0.3rem 0.75rem;
  border: 1px dashed var(--muted);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.connect:hover { border-style: solid; border-color: var(--cobalt); color: var(--cobalt); }
.connect.off { color: var(--muted); font-weight: 400; cursor: help; }

.more { position: relative; }
.more summary { cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  z-index: 5;
  display: grid;
  gap: 0.375rem;
  width: max-content;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sheet);
}

/* A parede de vídeos é o único elemento forte da tela. */
.wall { padding: 1.5rem 1.5rem 1.25rem; background: var(--cobalt); color: #fff; }

.wall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wall-head h2 {
  max-width: 16ch;
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.wall.has-videos .wall-head h2 { max-width: none; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }

.wall-actions { display: flex; gap: 0.5rem; }

.on-wall {
  padding: 0.5rem 1rem;
  border: 1px solid #fff;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.on-wall:hover { background: var(--cobalt-deep); }
.on-wall.solid { background: #fff; color: var(--cobalt-deep); }
.on-wall.solid:hover { background: var(--paper); }
.on-wall:has(input:focus-visible) { outline: 3px solid #fff; outline-offset: 2px; }

.rail { display: flex; gap: 0.875rem; padding: 4px 4px 0.75rem; overflow-x: auto; scrollbar-color: #fff6 transparent; }
.rail:empty { display: none; }

.tile { flex: 0 0 9.5rem; width: 9.5rem; }

.tile-frame {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 10px;
  background: var(--cobalt-deep);
  cursor: pointer;
}
.tile-frame video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tile.selected .tile-frame { outline: 3px solid #fff; outline-offset: 2px; }
.tile-frame:has(input:focus-visible) { outline: 3px solid #fff; outline-offset: 2px; }

.tile-check {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #1b183866;
  color: transparent;
  font-size: 0.875rem;
  font-weight: 700;
}
.tile.selected .tile-check { background: #fff; color: var(--cobalt-deep); }

.tile-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: #1b1838b3;
  color: #fff;
  line-height: 1;
  cursor: pointer;
}
.tile-remove:hover { background: var(--bad); }

.tile-time {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0 0.375rem;
  border-radius: 4px;
  background: #1b1838b3;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.tile-name { margin-top: 0.375rem; overflow: hidden; font-size: 0.8125rem; text-overflow: ellipsis; white-space: nowrap; }

.progress { position: absolute; inset: auto 0 0; height: 0.375rem; background: #fff4; }
.progress span { display: block; height: 100%; background: #fff; }

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr);
  gap: 2.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.editor { display: grid; gap: 1.5rem; align-content: start; }
.hint { max-width: 60ch; color: var(--muted); }

.editing-count { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

.field { display: grid; gap: 0.375rem; }
.field-label { font-weight: 600; }
.field-foot { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

textarea, input[type='text'], input[type='datetime-local'], select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet);
}
textarea { min-height: 8.5rem; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--cobalt); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 0.9375rem;
}
.chip b { font-weight: 600; }
.chip input:checked + span { border-color: var(--cobalt); background: var(--cobalt); color: #fff; }
.chip input:indeterminate + span { border-color: var(--cobalt); border-style: dashed; color: var(--cobalt); }
.chip input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.network { display: grid; gap: 0.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.network h3 { font-size: 1.0625rem; font-weight: 700; }
.network-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.check input { width: 1.0625rem; height: 1.0625rem; accent-color: var(--cobalt); }
.check.disabled { color: var(--muted); cursor: not-allowed; }
.fine { color: var(--muted); font-size: 0.875rem; max-width: 65ch; }

.warnings { margin: 0; padding: 0; list-style: none; color: var(--wait); font-size: 0.9375rem; }

.launch { display: grid; gap: 1rem; align-content: start; align-self: start; position: sticky; top: 1rem; }
.launch h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

.mode { display: flex; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); padding: 0.1875rem; }
.mode label { flex: 1; cursor: pointer; }
.mode input { position: absolute; opacity: 0; }
.mode span { display: block; padding: 0.375rem; border-radius: 4px; text-align: center; font-weight: 600; }
.mode input:checked + span { background: var(--ink); color: #fff; }
.mode input:focus-visible + span { outline: 3px solid var(--cobalt); outline-offset: 1px; }

.go {
  padding: 0.875rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--cobalt);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
}
.go:hover { background: var(--cobalt-deep); }
.go:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }

.plan { color: var(--muted); font-size: 0.9375rem; }

.problems { margin: 0; padding: 0.75rem 1rem; list-style: none; border-left: 3px solid var(--bad); background: var(--sheet); color: var(--bad); font-size: 0.9375rem; }

.rundown { max-width: 76rem; margin: 0 auto; padding: 0.5rem 1.5rem 4rem; }
.rundown h2 { margin-bottom: 0.5rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }

.row {
  display: grid;
  grid-template-columns: 2.75rem minmax(10rem, 1fr) minmax(0, 2.4fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.row video { display: block; width: 2.75rem; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 4px; background: var(--line); }
.row-title { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row-time { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 0.25rem; }

.statuses { display: flex; flex-wrap: wrap; gap: 0.375rem 1.5rem; }
.status { min-width: 0; font-size: 0.9375rem; }
.status b { font-weight: 600; }
.status .state { color: var(--muted); }
.status.published .state { color: var(--ok); font-weight: 600; }
.status.failed .state { color: var(--bad); font-weight: 600; }
.status.working .state { color: var(--wait); }
.status-error { color: var(--bad); font-size: 0.875rem; max-width: 60ch; }

.link-button {
  padding: 0.25rem 0.5rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--cobalt);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.link-button:hover { background: var(--line); }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: 10;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.625rem 1rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  transform: translateX(-50%);
}
.toast.bad { background: var(--bad); }

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #2337e6e6;
  color: #fff;
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  pointer-events: none;
}
.drop-veil[hidden], .toast[hidden] { display: none; }

.logout {
  padding: 0.3rem 0.75rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  cursor: pointer;
}
.logout:hover { color: var(--cobalt); }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--cobalt); }
.login-form { display: grid; gap: 1rem; width: min(24rem, 100%); padding: 2rem; border-radius: 10px; background: var(--paper); }
.login-form h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.login-form input { width: 100%; padding: 0.625rem 0.75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); }
.login-form input:focus { border-color: var(--cobalt); }
.login-error { color: var(--bad); font-size: 0.9375rem; }
.login-error[hidden] { display: none; }

@media (max-width: 860px) {
  .desk { grid-template-columns: 1fr; gap: 2rem; }
  .launch { position: static; }
  .row { grid-template-columns: 2.75rem minmax(0, 1fr); }
  .statuses, .row-actions { grid-column: 2; }
}

@media (max-width: 480px) {
  .top, .wall, .desk, .rundown { padding-left: 1rem; padding-right: 1rem; }
  .tile { flex-basis: 7.5rem; width: 7.5rem; }
}
