:root {
  --bg: #0f1115;
  --card: #161920;
  --card-2: #1d212a;
  --line: #272c37;
  --text: #e7e9ee;
  --muted: #99a1b0;
  --accent: #4a9eff;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }

.vh-top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}
.vh-top strong { font-size: 16px; }
.vh-top strong a { color: var(--text); }
.vh-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-left: auto; flex-wrap: wrap; }
.vh-top nav { display: flex; gap: 12px; }

main { max-width: 1100px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }

h2 { font-size: 16px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 4px; }

.vh-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }

.vh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: end; }
.vh-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.vh-grid label.wide { grid-column: 1 / -1; }
.vh-check { flex-direction: row !important; align-items: center; gap: 8px !important; }

input, select, textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font: inherit; font-size: 13px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
input[type="file"] { padding: 6px; }
input[type="checkbox"] { width: auto; }

button, .vh-btn {
  background: var(--accent); color: #04121f; border: 0; border-radius: 6px;
  padding: 9px 14px; font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; display: inline-block; text-align: center;
}
button:hover, .vh-btn:hover { filter: brightness(1.1); text-decoration: none; }
button:disabled { opacity: .6; cursor: default; }
.vh-btn.ghost, button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.vh-btn.danger, button.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }

progress { width: 100%; height: 6px; margin-top: 10px; }

.vh-muted { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.vh-error { color: var(--err); font-size: 12px; margin: 6px 0 0; word-break: break-word; }

.vh-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.vh-actions { margin-top: 12px; justify-content: flex-start; gap: 10px; }

.vh-badge { border-radius: 4px; padding: 1px 7px; font-size: 11px; background: var(--card-2); color: var(--muted); }
.vh-ready { color: var(--ok); }
.vh-processing { color: var(--warn); }
.vh-queued { color: var(--accent); }
.vh-error-badge, .vh-error.vh-badge { color: var(--err); }
.vh-badge.vh-error { color: var(--err); }

.vh-video details { margin-top: 10px; }
.vh-video summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; }
.vh-video details[open] summary { margin-bottom: 10px; }

.vh-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.vh-table th, .vh-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.vh-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.vh-embed { cursor: pointer; word-break: break-all; }

/* ------------------------------------------------------------ sortable */
.vh-sortable { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vh-sort-item {
  display: grid; grid-template-columns: 22px 26px auto 1fr auto;
  gap: 10px; align-items: center;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; cursor: grab;
}
.vh-sort-item.is-dragging { opacity: .45; cursor: grabbing; }
.vh-drag { color: var(--muted); cursor: grab; }
.vh-sort-pos { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.vh-sort-thumb { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; display: block; background: #000; }
.vh-sort-title { font-size: 13px; min-width: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vh-sort-item form { margin: 0; }

/* --------------------------------------------------------------- login */
.vh-login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.vh-login {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 14px;
}
.vh-login h1 { font-size: 18px; margin: 0 0 4px; text-align: center; }
.vh-login label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  main { padding: 14px; }
  .vh-card { padding: 14px; }
  .vh-sort-item { grid-template-columns: 22px 26px 1fr; }
  .vh-sort-thumb { display: none; }
}

/* reorder controls */
.vh-sort-item { grid-template-columns: 22px 26px auto 1fr auto auto; }
.vh-move { display: inline-flex; flex-direction: column; gap: 2px; }
.vh-move-btn {
  width: 26px; height: 18px; padding: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px;
  font-size: 9px; line-height: 1; cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.vh-move-btn:hover:not(:disabled) { background: var(--card); color: var(--accent); border-color: var(--accent); }
.vh-move-btn:disabled { opacity: .28; cursor: default; }
