:root {
  --bg: #f5f8fc;
  --card: #fff;
  --line: #dce5f0;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Sarabun", "Noto Sans Thai", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef4ff 0%, var(--bg) 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar h1 { margin: 0; font-size: 1.1rem; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.topbar nav { display: flex; gap: 8px; align-items: center; }

.container { width: min(1080px, 94vw); margin: 20px auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card.narrow { max-width: 420px; margin-inline: auto; }

.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

input[type='url'], input[type='text'], input[type='password'], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
textarea { min-height: 120px; }

button, .download, a.secondary {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.secondary, .secondary {
  background: #e5edf7;
  color: #0f172a;
}
button.danger {
  background: var(--danger);
}

.checkbox { display: inline-flex; align-items: center; gap: 8px; }
.banner { padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; }
.banner.info { background: #e8f2ff; }
.banner.warning { background: #fff7e5; }
.banner.error { background: #ffeceb; }
.banner.success { background: #ecfbf1; }
.error { color: var(--danger); }
.small { font-size: 0.85rem; }
.hint { color: var(--muted); }
.break { word-break: break-all; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }

.status { font-weight: 700; font-size: .85rem; }
.status.queued { color: #1d4ed8; }
.status.running { color: #b45309; }
.status.done { color: #047857; }
.status.failed { color: var(--danger); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
video {
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: 10px;
  background: #000;
}
.download { margin-top: 8px; width: 100%; }

@media (max-width: 720px) {
  .row { flex-direction: column; align-items: stretch; }
  .between { flex-direction: column; align-items: stretch; }
}
