:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #111827;
  --green: #16a34a;
  --red: #dc2626;
  --teal: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.locked {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #eef2f7;
  color: var(--text);
}

button.danger {
  background: #fee2e2;
  color: var(--red);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 22px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #111827, #0f766e);
}

body.locked .login-view {
  display: grid;
}

.login-card {
  width: min(420px, 100%);
  border-radius: 10px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.login-card .logo {
  margin-bottom: 18px;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card p {
  margin-bottom: 18px;
}

.login-card input,
.login-card button {
  margin-top: 12px;
}

.login-card button {
  width: 100%;
  height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: #f3f4f6;
  color: #111827;
  font-weight: 700;
}

.main {
  margin-left: 248px;
  padding: 30px;
}

.section {
  margin-bottom: 34px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 24px;
}

p {
  margin-top: 7px;
  color: var(--muted);
}

.section-header button {
  min-width: 92px;
  height: 40px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.table-card,
.form-card,
.course-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.metric {
  padding: 20px;
}

.metric span {
  display: block;
  font-size: 32px;
  font-weight: 900;
}

.metric small {
  color: var(--muted);
}

.table-card {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f9fafb;
  color: #4b5563;
  font-size: 13px;
}

td button {
  height: 32px;
  margin-right: 8px;
  padding: 0 12px;
  font-size: 13px;
}

.tag {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.tag.approved {
  background: #dcfce7;
  color: #166534;
}

.tag.pending {
  background: #fef3c7;
  color: #92400e;
}

.tag.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.form-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
}

.form-card textarea,
.form-card button {
  grid-column: span 2;
}

.form-card button {
  height: 44px;
}

.course-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.course-card {
  overflow: hidden;
}

.course-cover {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: #e5e7eb;
}

.course-body {
  padding: 16px;
}

.course-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.course-title strong {
  font-size: 18px;
}

.course-body p {
  line-height: 1.55;
}

.course-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.course-actions button {
  height: 34px;
  padding: 0 12px;
}

.lesson-form {
  display: grid;
  grid-template-columns: 1fr 100px 1fr 92px;
  gap: 8px;
  margin-top: 14px;
}

.lesson-form button {
  height: 42px;
}

.lessons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.lesson {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f9fafb;
}

.lesson span {
  color: var(--muted);
  font-size: 13px;
}

.intro-form {
  grid-template-columns: 1fr;
}

.intro-form textarea,
.intro-form button {
  grid-column: span 1;
}

.photo-uploader {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.photo-uploader img {
  width: 180px;
  height: 220px;
  border-radius: 8px;
  object-fit: cover;
  background: #e5e7eb;
}

.photo-uploader label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.photo-uploader small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .metrics,
  .course-list,
  .form-card {
    grid-template-columns: 1fr;
  }

  .form-card textarea,
  .form-card button {
    grid-column: span 1;
  }

  .lesson-form {
    grid-template-columns: 1fr;
  }

  .photo-uploader {
    grid-template-columns: 1fr;
  }

  .photo-uploader img {
    width: 100%;
    height: 260px;
  }
}
