:root {
  --bg: #0e0e10;
  --panel: #18181b;
  --panel-2: #1f1f23;
  --border: #2c2c32;
  --text: #efeff1;
  --muted: #a1a1aa;
  --accent: #9147ff;
  --accent-2: #772ce8;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, .14);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, .14);
  --amber: #f5b301;
  --amber-bg: rgba(245, 179, 1, .12);
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: #bf94ff; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 16px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; color: var(--text); background: var(--panel-2);
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-2); }
.btn-approve { background: var(--green-bg); border-color: rgba(34,197,94,.45); color: #86efac; }
.btn-approve:hover, .btn-approve.current { background: var(--green); color: #052e13; }
.btn-reject { background: var(--red-bg); border-color: rgba(239,68,68,.45); color: #fca5a5; }
.btn-reject:hover, .btn-reject.current { background: var(--red); color: #fff; }
.btn-discord { background: #5865f2; width: 100%; padding: 12px; font-size: 15px; }
.btn-discord:hover { background: #4752c4; }

/* ---------- barra superiore ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 20px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.view-switch { display: flex; gap: 4px; }
.view-switch a {
  padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 600;
}
.view-switch a.active { background: var(--panel-2); color: var(--text); }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user form { margin: 0; }
.avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.live { width: 8px; height: 8px; border-radius: 50%; background: #52525b; }
.live.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.2); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); height: calc(100vh - 56px); }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--panel); min-height: 0; }
.stage { padding: 20px 24px; overflow-y: auto; min-width: 0; }

/* ---------- filtri ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; border-bottom: 1px solid var(--border); }
.filters-title { font-weight: 700; padding: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip.attention:not(.active) { border-color: var(--amber); color: var(--amber); }

/* ---------- lista ---------- */
.list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.list-empty { color: var(--muted); padding: 24px 12px; text-align: center; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; border-left: 3px solid transparent;
  margin-bottom: 2px;
}
.item:hover { background: var(--panel-2); }
.item.selected { background: #26262c; border-color: var(--accent); }
.item.status-pending { border-left-color: var(--amber); background: var(--amber-bg); }
.item.status-pending.selected { background: #2e2a1c; }
.item.status-approved { border-left-color: var(--green); }
.item.status-rejected { border-left-color: var(--red); opacity: .6; }
.item.status-rejected.selected { opacity: 1; }
.thumb {
  width: 80px; height: 45px; flex: none; border-radius: 6px; object-fit: cover; background: #000;
}
.thumb-badge {
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: #3f3f46;
}
.p-youtube { background: #c4302b; } .p-twitch_clip, .p-twitch_vod { background: var(--accent); }
.p-tiktok { background: #111; border: 1px solid #333; } .p-instagram { background: linear-gradient(45deg,#f09433,#dc2743,#bc1888); }
.p-discord_file { background: #5865f2; }
.item-body { min-width: 0; flex: 1; }
.item-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pending .item-title { color: #fff; }
.item-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { flex: none; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; letter-spacing: .02em; }
.badge-pending { background: var(--amber); color: #2a1f00; }
.badge-approved { background: var(--green-bg); color: #86efac; }
.badge-rejected { background: var(--red-bg); color: #fca5a5; }

/* ---------- player ---------- */
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 68vh;
  background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
}
.player.vertical { aspect-ratio: auto; height: 68vh; background: #000; display: flex; justify-content: center; }
.player.vertical iframe, .player.vertical video { width: auto; aspect-ratio: 9 / 16; height: 100%; }
.player iframe, .player video { width: 100%; height: 100%; border: 0; display: block; background: #000; }
.player.empty { display: grid; place-items: center; background: var(--panel); }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; }
.placeholder-icon { font-size: 40px; opacity: .6; }

/* ---------- azioni e dettagli ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; align-items: center; }
.actions .btn { min-width: 120px; }
.spacer { flex: 1; }
.details { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.detail-title { margin: 0 0 8px; font-size: 18px; overflow-wrap: anywhere; }
.detail-author { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-text {
  margin: 12px 0 0; padding: 8px 12px; border-left: 3px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere; color: #d4d4d8;
}
.detail-row { margin-top: 10px; color: var(--muted); }
.detail-links { margin-top: 10px; overflow-wrap: anywhere; }
.shortcuts { font-size: 12px; margin-top: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); font-weight: 600;
}
.toast.error { border-color: var(--red); color: #fca5a5; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px 24px;
}
.login-card h1 { margin: 8px 0 4px; }
.login-logo { font-size: 40px; }
.login-error { background: var(--red-bg); color: #fca5a5; padding: 10px; border-radius: 8px; }

/* ---------- schermi stretti ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .layout > * { min-width: 0; }
  .actions .btn { min-width: 0; flex: 1; }
  .actions .spacer { display: none; }
  .stage { order: -1; padding: 12px; }
  .sidebar { border-right: 0; border-top: 1px solid var(--border); }
  .list { max-height: none; }
  .player.vertical { height: 70vh; }
  .shortcuts { display: none; }
  .topbar { gap: 10px; }
  #username { display: none; }
}
