:root {
  --bg: #0d0f13;
  --panel: #161a21;
  --panel-2: #1d222b;
  --line: #2a313d;
  --text: #e9edf3;
  --muted: #8b95a5;
  --accent: #f5c518;
  --accent-ink: #1a1500;
  --late: #ff3b3b;
  --ok: #2fbf71;
  --grid: 92px 150px minmax(0, 1fr) 150px 150px 170px 118px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100vh; }

/* ---------- rundown ---------- */
.rundown { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.rundown-head { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.titles { min-width: 0; flex: 1; }
h1 { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress b { color: var(--text); }
.progress .late-count { color: var(--late); font-weight: 700; margin-left: 10px; }

.cols, .row { display: grid; grid-template-columns: var(--grid); gap: 12px; align-items: start; }
.cols { padding: 7px 18px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.list { flex: 1; overflow-y: auto; padding: 6px 10px 60vh; scroll-behavior: smooth; }

.row { padding: 9px 8px; border-radius: 8px; border: 1px solid transparent; border-bottom-color: var(--line); transition: opacity .25s, background .25s; }
.row > div { min-width: 0; overflow-wrap: anywhere; }
.time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.time.none { color: var(--muted); font-size: 14px; font-weight: 400; }
.dur { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.talent { color: #b9c6ff; font-weight: 600; font-size: 13px; }
.content { font-weight: 700; font-size: 15px; }
.script { color: #c3cad6; font-size: 13px; white-space: pre-line; margin-top: 3px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: pointer; }
.row.current .script { -webkit-line-clamp: 8; }
.row.open .script { -webkit-line-clamp: unset; display: block; }
.gfx { font-size: 12.5px; white-space: pre-line; color: #d7dde7; }
.gfx.flowics { color: #7fd6ff; }
.gfx.leds { color: #ffc98a; }
.gfx.broadcast { color: #a6f0c0; }
.gfx[data-label]::before { display: none; content: attr(data-label) ": "; color: var(--muted); }

.row .exec { justify-self: end; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.row .exec:hover { border-color: var(--accent); color: var(--accent); }

.row.block { background: var(--panel); }
.row.block .content { color: var(--accent); }

.row.done { opacity: .32; }
.row.done .exec { font-weight: 500; }
.row.done .script { -webkit-line-clamp: 1; }

.row.current { background: #20263a; border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.row.current .exec { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.row.late { animation: late 1s steps(2, jump-none) infinite; border-color: var(--late); }
.row.late .time { color: #fff; }
@keyframes late {
  from { background: rgba(255, 59, 59, .55); }
  to { background: rgba(255, 59, 59, .12); }
}
@media (prefers-reduced-motion: reduce) {
  .row.late { animation: none; background: rgba(255, 59, 59, .35); }
  .list { scroll-behavior: auto; }
}

.section { margin: 14px 0 6px; padding: 7px 12px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }

.jump { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 9px 16px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--bg); text-align: center; padding: 20px; }
.empty[hidden], .jump[hidden], .toast[hidden] { display: none; }
.empty h2 { margin: 0; }
.empty p { color: var(--muted); margin: 0 0 12px; }

/* ---------- painel lateral ---------- */
.side { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: #0a0c0f; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.clock { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.conn { font-size: 11px; color: var(--muted); }
.conn.on { color: var(--ok); }
.conn.off { color: var(--late); }

.countdown { font-size: 84px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-align: center; padding: 6px 0 10px; color: var(--muted); }
.countdown-card.running .countdown { color: var(--text); }
.countdown-card.warn .countdown { color: var(--late); }
.countdown-card.over { border-color: var(--late); animation: late 1s steps(2, jump-none) infinite; }
.countdown-card.over .countdown { color: #fff; }
.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.countdown-card.warn .bar i { background: var(--late); }
.cd-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.cd-buttons .ghost { grid-column: 1 / -1; }

.btn { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; font-weight: 500; color: var(--muted); }
.btn:focus-visible, .exec:focus-visible, .jump:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.now { font-size: 17px; font-weight: 700; margin: 4px 0 10px; overflow-wrap: anywhere; }
.now small, .next small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.now.late { color: var(--late); }
.now-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.up-next { margin-top: 12px; }
.next { font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }

.schedule, .urls { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.schedule li { display: flex; gap: 10px; font-size: 13px; }
.schedule b { font-variant-numeric: tabular-nums; color: var(--accent); }

summary { cursor: pointer; font-weight: 700; }
.file, .hint { color: var(--muted); font-size: 12px; margin: 8px 0; overflow-wrap: anywhere; }
.sheet { display: grid; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
select { width: 100%; padding: 8px; border-radius: 6px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); font: inherit; }
.file-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.urls li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; font-size: 12px; }
.urls span { color: var(--muted); grid-column: 1 / -1; margin-top: 6px; }
.urls code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; overflow-x: auto; white-space: nowrap; font-size: 11.5px; }
.urls button { padding: 5px 8px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel-2); font-size: 11px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: #111; padding: 10px 16px; border-radius: 8px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .6); z-index: 10; max-width: 90vw; }

/* ---------- telas menores ---------- */
@media (max-width: 1500px) {
  :root { --grid: 80px 120px minmax(0, 1fr) 130px 130px 140px 108px; }
}
@media (max-width: 1180px) {
  :root { --grid: 74px minmax(0, 1fr) 108px; }
  .cols { display: none; }
  .row .talent, .row .main, .row .gfx { grid-column: 2; }
  .row .time-cell { grid-row: 1 / span 6; }
  .row .exec { grid-column: 3; grid-row: 1 / span 6; }
  .gfx:empty { display: none; }
  .gfx[data-label]::before { display: inline; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .side { order: -1; position: sticky; top: 0; z-index: 5; max-height: 46vh; }
  .rundown { border-right: 0; height: 100vh; }
  .countdown { font-size: 56px; }
  .clock { font-size: 26px; }
}
