:root {
  --bg: #0f1117;
  --bg-elev: #1a1d27;
  --bg-elev-2: #232634;
  --fg: #e8eaf0;
  --fg-muted: #9aa0ac;
  --accent: #5b8cff;
  --accent-2: #ff5b8c;
  --danger: #ff5b5b;
  --ok: #4cd99f;
  --border: #2a2f3d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
header.topbar .brand {
  font-weight: 700; font-size: 16px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
header.topbar .right { display: flex; align-items: center; gap: 12px; }
header.topbar .user { color: var(--fg-muted); font-size: 13px; }
header.topbar button {
  background: var(--bg-elev-2); color: var(--fg); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
header.topbar button:hover { border-color: var(--accent); }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
  cursor: pointer;
}
.video-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.video-card .cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2a2f3d, #1a1d27);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-muted); font-size: 36px;
}
.video-card .body { padding: 12px 14px; }
.video-card .title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.video-card .meta { color: var(--fg-muted); font-size: 12px; }

input, textarea, select, button {
  font-family: inherit; font-size: 14px;
}
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  outline: none;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label { display: block; margin-bottom: 6px; color: var(--fg-muted); font-size: 12px; }
.field { margin-bottom: 14px; }

.btn {
  background: var(--accent); color: white; border: none;
  padding: 9px 16px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); color: #0f1117; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; }

table { width: 100%; border-collapse: collapse; }
table th, table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table th { color: var(--fg-muted); font-weight: 600; font-size: 12px; }
table tr.expired td { opacity: .55; }
table td.expire { white-space: nowrap; }
.expire-soon { color: #ffc24c; }
.expire-expired { color: var(--danger); }

.empty {
  text-align: center; padding: 60px 20px; color: var(--fg-muted);
}

.login-wrap {
  min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center;
}
.login-card { width: 360px; max-width: 92%; }
.login-card h1 {
  margin: 0 0 20px; font-size: 20px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.toast {
  position: fixed; right: 20px; bottom: 20px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 8px; min-width: 200px;
  animation: slideIn .2s;
}
.toast.err { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.progress {
  height: 6px; background: var(--bg-elev-2); border-radius: 3px; overflow: hidden;
  margin-top: 8px;
}
.progress .bar { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

video.player { width: 100%; max-height: calc(100vh - 140px); background: black; border-radius: 8px; }

.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.right { text-align: right; }