:root {
  --bg: #0f1115;
  --card: #171a21;
  --card2: #1e222b;
  --line: #2a2f3a;
  --tx: #e8eaf0;
  --dim: #9aa3b4;
  --accent: #e0a24a;
  --danger: #d9534f;
  --ok: #4caf7d;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--tx);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.centre { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 20px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.dim { color: var(--dim); }
.small { font-size: 13.5px; }
.err { color: var(--danger); }

/* header */
.bar { background: #12151b; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.bar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.bar nav { display: flex; gap: 6px; align-items: center; }
.bar nav a {
  color: var(--dim); text-decoration: none; padding: 7px 12px;
  border-radius: 8px; font-size: 14.5px;
}
.bar nav a:hover { color: var(--tx); background: var(--card2); }
.bar nav a.on { color: var(--tx); background: var(--card2); }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin: 18px 0;
}
.card h2 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.card.hero h2 { font-size: 21px; }
.hero { border-color: #33405a; background: linear-gradient(180deg, #1a2030, var(--card)); }

/* forms */
input[type=text], input[type=password], select, textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line);
  color: var(--tx); border-radius: 10px; padding: 11px 13px; font: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid #3b4a6b; outline-offset: 1px; }
button {
  background: var(--accent); color: #1a1206; border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; }
button.wide { width: 100%; display: block; margin-top: 10px; }
button.link { background: none; color: var(--dim); font-weight: 400; padding: 7px 10px; }
button.link:hover { color: var(--tx); background: var(--card2); filter: none; }
button.danger { background: #33232a; color: #f0a9a6; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row input[type=text] { flex: 1 1 220px; width: auto; }
.stack > * + * { margin-top: 10px; }
pre {
  background: #0c0e12; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; font-size: 13px; color: #b8e0c8;
  white-space: pre-wrap; word-break: break-all;
}
ul { margin: 8px 0 0; padding-left: 20px; }
a { color: var(--accent); }

/* chat */
.chat { max-height: 46dvh; overflow-y: auto; padding: 4px 2px; margin-bottom: 12px; }
.bubble {
  max-width: 84%; padding: 10px 14px; border-radius: 14px; margin: 8px 0;
  white-space: pre-wrap; word-wrap: break-word;
}
.bubble.joe { background: var(--card2); border: 1px solid var(--line); }
.bubble.you { background: #2b3a2f; margin-left: auto; }

/* gallery */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tile video { width: 100%; display: block; background: #000; }
.tile-title { padding: 10px 12px; font-size: 14.5px; }

/* admin list */
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 14px; margin-top: 10px;
}
.item-main { min-width: 0; }
.item-title { font-weight: 600; margin-bottom: 3px; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.item-actions button { padding: 7px 13px; font-size: 14px; }
.pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12.5px; border: 1px solid var(--line); color: var(--dim);
}
.pill.published { color: #9fe3bd; border-color: #2f5c45; }
.pill.failed { color: #f0a9a6; border-color: #5c2f2f; }
.pill.queued, .pill.rendering { color: #f0d29a; border-color: #5c4c2f; }

/* login */
.login { width: 100%; max-width: 380px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }

@media (max-width: 560px) {
  .item { flex-direction: column; align-items: stretch; }
  .item-actions { justify-content: flex-end; }
  .bubble { max-width: 92%; }
}
