:root {
  --bg: #0b0b0f;
  --panel: #14141b;
  --panel-2: #1b1b24;
  --line: #262632;
  --text: #f2f2f5;
  --muted: #8b8b9a;
  --accent: #7c5cff;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #3a3a4a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.muted { color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 26px; }
.login .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; }
.error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* Shell */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: rgba(11,11,15,.85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; }
.tabs a.on { background: var(--panel-2); color: var(--text); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }

/* Board */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 200px; }
.col.drop { border-color: var(--accent); background: #17142a; }
.col h2 { display: flex; align-items: center; gap: 8px; margin: 2px 4px 12px; font-size: 14px; font-weight: 600; }
.col h2 .count { color: var(--muted); font-weight: 500; }
.col .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: #3a3a4a; }
.card.dragging { opacity: .4; }
.card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.card .poster { aspect-ratio: 4 / 5; background: #000 center / cover no-repeat; position: relative; }
.card .poster .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.7); padding: 1px 6px; border-radius: 6px; font-size: 11px; }
.card .poster .views { position: absolute; left: 10px; top: 6px; background: rgba(0,0,0,.7); padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.card .body { padding: 8px 10px 10px 12px; }
.card .title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; margin-top: 3px; }
.card .meta .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: #262632; color: #cfcfe0; text-transform: capitalize; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters input { max-width: 260px; }
.filters select { max-width: 200px; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 1000px; max-height: calc(100vh - 32px); overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.modal .player { background: #000; display: grid; place-items: center; min-height: 360px; border-radius: 20px 0 0 20px; }
.modal video { width: 100%; max-height: calc(100vh - 32px); display: block; }
.modal .side { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.modal .side h3 { margin: 14px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.modal .close { position: absolute; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input:not([type=checkbox]):not([type=color]) { flex: 1; width: auto; min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.post { display: grid; grid-template-columns: 1fr 90px auto; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.post a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.post input { padding: 5px 8px; }
.post .auto { font-size: 10px; color: var(--green); }

/* Upload */
.drawer { position: fixed; right: 16px; bottom: 16px; width: 380px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; z-index: 40; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.drawer header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.drawer .list { max-height: 50vh; overflow: auto; padding: 8px 14px; }
.up { padding: 8px 0; border-bottom: 1px solid var(--line); }
.up:last-child { border-bottom: 0; }
.up .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0 3px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.up.done .bar i { background: var(--green); }
.up.failed .bar i { background: var(--red); }
.up .small { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.dropzone { position: fixed; inset: 0; z-index: 60; background: rgba(124,92,255,.15); border: 3px dashed var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 700; pointer-events: none; }

/* Stats */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; text-transform: capitalize; }
.hbar .track { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.chart { width: 100%; height: 160px; display: block; }
.chart rect { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; }
.top-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222230; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 70; }

@media (max-width: 1000px) {
  .board { grid-template-columns: 1fr; }
  .modal { grid-template-columns: 1fr; }
  .modal .player { border-radius: 20px 20px 0 0; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  main { padding: 16px; }
  .me .name { display: none; }
}
