:root {
  --green: #2db142; --green-dark: #1f8a31; --green-soft: #e7f6ea;
  --ink: #2c2d2e; --muted: #6b6f74; --line: #e4e6e8; --bg: #f6f7f5; --card: #fff;
  --purple: #6b2199; --purple-soft: #f1e8f7;
  --amber: #b26a00; --amber-soft: #fff3dc; --red: #c0392b; --red-soft: #fdecea; --blue: #1d5fbf; --blue-soft: #e8f0fc;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 10px 24px;
  background: var(--ink); color: #fff; flex-wrap: wrap; }
.top .brand { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.top .brand .muted { color: #9fe3ab; font-weight: 600; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { color: #d8dadc; padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.top nav a.on { background: var(--green); color: #fff; }
.top nav a:hover { text-decoration: none; background: rgba(255,255,255,.08); }
.top .right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.top .sync { font-size: 12px; color: #b9bcbf; }
.top .sync.err { color: #ffb4a8; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--purple); color: #fff; font-size: 12px; text-align: center; }
.count:empty { display: none; }
.count.live { background: var(--amber); }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.stat .num { font-size: 26px; font-weight: 800; margin-top: 2px; }
.stat .sub { font-size: 13px; color: var(--muted); }

button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--green-dark); background: var(--green); color: #fff;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover { background: var(--green-dark); }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: inherit; border-color: var(--line); }
.top button.ghost { color: #fff; border-color: #55585b; }
button.ghost:hover { background: rgba(0,0,0,.05); }
button.warn { background: var(--amber); border-color: var(--amber); }
button.danger { background: #fff; color: var(--red); border-color: #e9b8b2; }
button.danger:hover { background: var(--red-soft); }
button.purple { background: var(--purple); border-color: var(--purple); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: inherit; }
textarea { width: 100%; resize: vertical; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { background: #fff; color: var(--ink); border: 0; border-radius: 0; padding: 7px 14px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #fafbfa; cursor: default; white-space: nowrap; }
th.sort { cursor: pointer; }
th.sort.on { color: var(--ink); }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fafcf9; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.thumb { width: 40px; height: 60px; object-fit: cover; border-radius: 6px; background: #ddd; display: block; }
.name { font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-published { background: var(--green-soft); color: var(--green-dark); }
.s-scheduled { background: var(--blue-soft); color: var(--blue); }
.s-review { background: var(--purple-soft); color: var(--purple); }
.s-approved { background: #e6f7f4; color: #11766a; }
.s-changes, .s-production { background: var(--amber-soft); color: var(--amber); }
.s-failed, .s-error { background: var(--red-soft); color: var(--red); }
.plat { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; white-space: nowrap; }
.plat a { font-weight: 700; }
.pdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #ccc; }
.pdot.PUBLISHED { background: var(--green); } .pdot.QUEUE { background: var(--blue); } .pdot.ERROR { background: var(--red); } .pdot.DRAFT { background: var(--amber); }

.detail { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
video.player { width: 100%; aspect-ratio: 9/16; background: #000; border-radius: var(--radius); }
.stills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.still img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; cursor: zoom-in; display: block; }
.still .meta { font-size: 12px; color: var(--muted); margin: 4px 0; min-height: 34px; }
.still.unused img { opacity: .45; }
.platcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.metrics { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.metrics b { font-size: 16px; display: block; }
.note { background: var(--amber-soft); border: 1px solid #f0d49a; padding: 10px 12px; border-radius: 8px; }
.note.info { background: var(--blue-soft); border-color: #bcd0f2; }
.note.bad { background: var(--red-soft); border-color: #f0bdb6; }
pre.log { background: #1d1f21; color: #d6d9dc; padding: 14px; border-radius: var(--radius); max-height: 70vh; overflow: auto; font-size: 12.5px; white-space: pre-wrap; }
pre.report { white-space: pre-wrap; font-size: 13px; background: #fafbfa; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; }
details summary { cursor: pointer; font-weight: 700; margin: 12px 0 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.rcard video { width: 100%; aspect-ratio: 9/16; background: #000; border-radius: 8px; }
.rcard .title { font-weight: 700; margin: 8px 0 2px; }
.login { max-width: 360px; margin: 12vh auto; text-align: center; }
.login input { width: 100%; margin: 12px 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; }
.modal img.big { max-width: 100%; max-height: 80vh; display: block; margin: auto; border-radius: 8px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
kbd { background: #eee; border-radius: 4px; padding: 0 5px; font-size: 12px; }
@media (max-width: 700px) { main { padding: 16px; } .hide-sm { display: none; } }

.fcard .spark-wrap { position: relative; margin: 10px 0 4px; }
svg.spark { width: 100%; height: 84px; display: block; overflow: visible; cursor: crosshair; }
.spark-line { fill: none; stroke: var(--green-dark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-base { stroke: var(--line); stroke-width: 1; }
.spark-dot { fill: var(--green-dark); stroke: #fff; stroke-width: 2; }
.spark-end { fill: var(--green-dark); stroke: #fff; stroke-width: 2; }
.spark-x { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.spark-tip { position: absolute; top: -8px; background: var(--ink); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.spark-empty { height: 84px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 8px; text-align: center; padding: 8px; }
