:root { --ink: #1c2733; --paper: #f4f6f8; --accent: #0e7a4f; --accent2: #0b5d3b; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--paper); color: var(--ink); }
main { max-width: 980px; margin: 0 auto; padding: 16px; }

.topbar { display: flex; align-items: center; gap: 12px;
          background: #123; color: #fff; padding: 10px 16px; }
.topbar .brand { font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar a { color: #cde; text-decoration: none; }

h2, h3 { margin: 8px 0 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.card { background: #fff; border-radius: 12px; padding: 18px;
        box-shadow: 0 1px 4px rgba(0,0,0,.08); margin: 14px 0; }
.card.narrow { max-width: 460px; margin: 40px auto; }

label { display: block; margin: 12px 0; font-weight: 600; }
label input, label select { display: block; width: 100%; margin-top: 6px;
  padding: 10px; font-size: 16px; border: 1px solid #ccd; border-radius: 8px; }
label small { font-weight: 400; color: #678; }
label.inline { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
label.inline input { display: inline; width: auto; margin: 0 4px 0 0; }

button, .btn { display: inline-block; background: var(--accent); color: #fff;
  border: 0; padding: 10px 18px; border-radius: 8px; font-size: 15px;
  text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { background: var(--accent2); }
.btn.ghost, button.ghost { background: #fff; color: var(--accent);
  border: 1px solid var(--accent); }
.btn.big { display: block; text-align: center; font-size: 20px;
  padding: 18px; margin: 18px 0; border-radius: 12px; }

.videolist .video { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; background: #fff; border-radius: 10px; padding: 12px 14px;
  margin: 8px 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.vmain { flex: 1; min-width: 0; }
.vtitle small { color: #789; font-weight: 400; margin-left: 8px; }
.vactions { display: flex; flex-direction: column; gap: 6px; }
/* action buttons */
.btn.act { background: #d97706; }
.btn.act:hover { background: #b45309; }
.btn.dl {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff; font-weight: 700; font-size: 16px;
  padding: 12px 22px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
}
.btn.dl:hover { background: linear-gradient(135deg, #15803d, #166534); transform: translateY(-1px); }
button.danger { background: #c0392b; }
button.danger:hover { background: #96281b; }
button.small, .btn.small { padding: 6px 12px; font-size: 13px; }

/* pipeline stepper */
.stepper { display: flex; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.stepper .chip { padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: #edf1f4; color: #8aa; white-space: nowrap; }
.stepper .chip.done   { background: #e3efe9; color: #14532d; }
.stepper .chip.done::after { content: ' ✓'; }
.stepper .chip.now    { background: var(--accent); color: #fff; }
.stepper .chip.busy   { background: var(--accent); color: #fff;
  animation: pulse 1.2s ease-in-out infinite; }
.stepper .chip.fail   { background: #b22; color: #fff; }
.stepper .arrow { color: #bcd; margin: 0 4px; font-size: 12px; }

.statustext { font-size: 13px; color: #567; display: inline-flex; align-items: center; gap: 8px; }
.statustext.err { color: #b22; }
.statustext.ok  { color: var(--accent2); font-weight: 600; }

.spinner { width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #cfe3d8; border-top-color: var(--accent);
  display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.55; } }

/* progress bar + ETA */
.pbar { height: 8px; border-radius: 999px; background: #e6ebe8;
  margin: 6px 0 2px; overflow: hidden; max-width: 420px; }
.pfill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #35b37f);
  transition: width 1s ease; }
.eta { font-size: 12px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: #e3efe9; color: #14532d; font-size: 13px; margin: 4px 0; }
.badge.err { background: #fde8e8; color: #7a1f1f; }
.muted { color: #678; font-size: 14px; }
.error { color: #b22; }
.ok { color: #177; }

.crestpreview { display: block; height: 90px; margin: 8px 0; }
.crestbox img { background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }

canvas { display: block; max-width: 100%; margin: 10px 0;
  border-radius: 10px; touch-action: none; }

.clipgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; }
.clip { background: #fff; border: 1px solid #dde; border-radius: 10px;
  padding: 8px; text-align: center; cursor: pointer; }
.clip:has(input:checked) { border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent); }
.clip img { width: 100%; border-radius: 6px; display: block; }
.clip input { transform: scale(1.4); margin: 6px; }
.clipinfo { display: block; font-size: 13px; color: #456; margin-top: 4px; }

@media (max-width: 640px) {
  .videolist .video { flex-direction: column; align-items: flex-start; }
  .vactions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .card { padding: 14px; }
}

.btn.off { background: #e7ebe9; color: #9ab; pointer-events: none; opacity: .7; }
