:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --primary: #8b5fbf;
  --secondary: #3fb7a8;
  --text: #243041;
  --muted: #6f7d92;
  --border: #e4e9f2;
  --danger: #d9534f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top left, #fdfcff 10%, #f1f7f7 45%, #eef2fa 100%);
  color: var(--text);
}
a { text-decoration: none; color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 30px rgba(37, 50, 78, .08);
}
.nav-left { gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; }
.brand span { color: var(--text); }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(36, 48, 65, .06);
}

.btn {
  background: linear-gradient(110deg, var(--primary), #a36dda);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { opacity: .95; transform: translateY(-1px); }
.btn.secondary { background: linear-gradient(110deg, var(--secondary), #5bcfbc); }
.btn.danger { background: var(--danger); }
.btn.tiny { padding: 6px 10px; border-radius: 8px; font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fbfcff;
  color: var(--text);
}
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(63,183,168,.15);
}
textarea { min-height: 88px; }

h1,h2,h3 { margin-top: 0; }
.muted { color: var(--muted); }
.flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { background: #edf1f8; color: #40506a; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.role.admin { background: #efe8fb; color: #6f41a4; }
.pill.role.student { background: #e4f8f2; color: #2e8b72; }

.alert { padding: 11px 12px; border-radius: 10px; margin-bottom: 14px; }
.alert.error { background: #fff3f2; color: #a33d3a; border: 1px solid #f8d5d3; }
.alert.success { background: #eefbf7; color: #2f7f68; border: 1px solid #cdefe4; }

.table { width: 100%; border-collapse: collapse; overflow: hidden; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: top; }
.user-edit-form { padding: 14px; background: #fafbff; border: 1px dashed var(--border); border-radius: 12px; margin: 8px 0; }

.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form.block { display: flex; justify-content: space-between; width: 100%; padding: 8px 0; border-bottom: 1px solid var(--border); }
.action-list { display: flex; flex-wrap: wrap; gap: 6px; }

.login-shell { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 24px; }
.login-card { max-width: 460px; width: 100%; }

.progress { height: 10px; background: #edf0f8; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 10px; background: linear-gradient(90deg, #8b5fbf, #3fb7a8); }
video { width: 100%; border-radius: 14px; background: #000; }
.video-embed { width: 100%; min-height: 420px; border: 0; border-radius: 14px; background: #000; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; }
.lesson-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.playlist { display: flex; flex-direction: column; gap: 8px; }
.playlist-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.playlist-item.active { border-color: var(--primary); background: #f8f3ff; }

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .topnav { flex-direction: column; align-items: flex-start; }
  .wrap { padding: 14px; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
