:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #161a2b;
  --muted: #667085;
  --line: #e4e7ef;
  --brand: #5b4bff;
  --brand-ink: #ffffff;
  --brand-soft: #eeebff;
  --ok: #12805c;
  --ok-soft: #e3f6ee;
  --warn: #a15c07;
  --warn-soft: #fff3dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.03em; color: var(--ink); display: flex; align-items: center; gap: 0.5rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #5b4bff, #ff4d8d); display: inline-block; }
.nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 0.4rem 0.75rem; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a.admin-link { color: #8a2bd8; }
.who { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; }
main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 0.75rem; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
textarea.tall { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.field + .field { margin-top: 0.9rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 0.3rem; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 0.55rem 1rem; border: 1px solid var(--line);
  background: #fff; color: var(--ink); display: inline-flex; align-items: center; gap: 0.4rem;
}
button:hover:not(:disabled), .btn:hover { background: var(--bg); text-decoration: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover:not(:disabled) { background: #4a3bec; }
button.danger { color: var(--bad); }
button.small, .btn.small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }

/* ---------- badges & notices ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--bg); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.live { background: var(--brand-soft); color: var(--brand); }
.verify-bar { background: var(--panel); border-bottom: 1px solid var(--line); }
.verify-bar .notice { max-width: 1080px; margin: 0 auto; border-radius: 0; }
.notice { padding: 0.8rem 1rem; border-radius: 10px; background: var(--brand-soft); color: #33288f; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice ol, .notice ul { margin: 0.4rem 0 0 1.1rem; padding: 0; }
.notice li + li { margin-top: 0.3rem; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: 0.55rem 0.9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-color: var(--brand); text-decoration: none; }

/* ---------- lists ---------- */
.post { display: grid; grid-template-columns: 72px 1fr auto; gap: 0.9rem; align-items: center; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.post:first-child { border-top: 0; }
.post img, .thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--bg); }
.post .title { font-weight: 600; }
.copy { display: flex; gap: 0.5rem; align-items: center; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; background: rgba(16, 24, 40, 0.06); padding: 0.1rem 0.4rem; border-radius: 6px; word-break: break-all; }
pre.code { padding: 0.75rem; white-space: pre-wrap; max-height: 360px; overflow: auto; border-radius: 10px; }

.clip { display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem; }
.clip video { width: 100%; border-radius: 12px; background: #0b0d17; aspect-ratio: 9 / 16; object-fit: contain; }
.clip .placeholder { aspect-ratio: 9 / 16; border-radius: 12px; background: linear-gradient(160deg, #eef0ff, #fbeefa); display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--muted); font-size: 0.9rem; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.9s linear infinite; margin: 0 auto 0.6rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.platforms { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.platform-pick { border: 1px solid var(--line); border-radius: 10px; padding: 0.4rem 0.7rem; display: flex; gap: 0.4rem; align-items: center; font-weight: 600; font-size: 0.9rem; }
.platform-pick.off { opacity: 0.5; }
.logo-preview { width: 120px; height: 120px; border: 1px dashed var(--line); border-radius: 14px; display: grid; place-items: center; background: repeating-conic-gradient(#f0f1f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; }
.stat { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

.auth-wrap { max-width: 420px; margin: 8vh auto 0; }
.toast-host { position: fixed; bottom: 1.25rem; right: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 0.7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.bad { background: var(--bad); }

@media (max-width: 720px) {
  .clip { grid-template-columns: 1fr; }
  .clip > :first-child { max-width: 240px; }
  .post { grid-template-columns: 56px 1fr; }
  .post img, .thumb { width: 56px; height: 56px; }
  .post > :last-child { grid-column: 1 / -1; }
  .topbar-inner { flex-wrap: wrap; gap: 0.75rem; }
}

.narrow { max-width: 720px; }

table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); }
table.table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.card:has(> table.table) { overflow-x: auto; }
