:root {
  --accent: #FF6B35;
  --accent-dark: #E5552A;
  --accent-light: #FF8A5B;
  --accent-tint: #FFF1EB;
  --accent-grad: linear-gradient(135deg, #FF8A5B 0%, #FF6B35 55%, #E5552A 100%);

  --text: #14110F;
  --text-2: #5A534D;
  --text-3: #948C84;

  --bg: #FFFFFF;
  --bg-page: #F6F4F1;
  --bg-soft: #FAF8F6;
  --bg-hover: #F2EFEB;
  --border: #ECE7E1;
  --border-2: #E2DBD3;
  --border-strong: #1A1A1A;

  --danger: #C0392B;
  --ok: #0D7C66;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(20, 17, 15, 0.05);
  --shadow-sm: 0 2px 8px rgba(20, 17, 15, 0.05), 0 1px 2px rgba(20, 17, 15, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(20, 17, 15, 0.12), 0 2px 6px rgba(20, 17, 15, 0.05);
  --shadow-lg: 0 24px 60px -18px rgba(20, 17, 15, 0.22);
  --shadow-accent: 0 14px 30px -10px rgba(229, 85, 42, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-page);
  background-image:
    radial-gradient(900px 500px at 100% -5%, rgba(255, 138, 91, 0.10), transparent 60%),
    radial-gradient(700px 500px at -5% 0%, rgba(255, 107, 53, 0.06), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'SF Mono', Monaco, Menlo, 'Courier New', monospace; font-size: 0.9em; background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); }

::selection { background: var(--accent); color: #fff; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__logo { height: 26px; width: auto; }
.brand__sep { width: 1px; height: 20px; background: var(--border-2); }
.brand__app { font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }

.topnav { display: flex; align-items: center; gap: 6px; }
.topnav__link {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.topnav__link:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.topnav__link--ghost { color: var(--text-3); }
.topnav__user { font-size: 13px; color: var(--text-2); font-weight: 500; padding-left: 14px; margin-left: 6px; border-left: 1px solid var(--border-2); }
.topnav__logout { display: inline; margin: 0; }

/* ===== Main ===== */
.main { max-width: 1180px; margin: 0 auto; padding: 44px 32px 32px; }

.page-header { margin: 0 0 30px; }
.page-header--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header h1 {
  margin: 6px 0 8px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.page-header__lead { margin: 0; color: var(--text-2); font-size: 17px; max-width: 60ch; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
}
.kicker::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--accent-grad); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  transition: color 0.15s, gap 0.15s;
}
.back-link:hover { color: var(--accent-dark); text-decoration: none; gap: 9px; }

/* ===== Module grid ===== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}
.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 26px 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(.2,.7,.2,1), box-shadow 0.22s, border-color 0.22s;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.22s;
}
.module-card:hover {
  border-color: transparent;
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.module-card:hover::before { opacity: 1; }
.module-card__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  font-family: 'SF Mono', Monaco, Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-tint);
  border-radius: 11px;
  margin-bottom: 16px;
}
.module-card__title { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.module-card__subtitle { margin: 5px 0 0; color: var(--text-3); font-size: 13px; font-weight: 500; }
.module-card__desc { margin: 12px 0 0; color: var(--text-2); font-size: 14.5px; line-height: 1.5; flex: 1; }
.module-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

/* progress bar inside module card */
.progress { margin-top: 16px; }
.progress__track { height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.progress__fill { height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width 0.4s ease; }
.progress__label { display: block; margin-top: 7px; font-size: 12px; color: var(--text-3); font-weight: 500; }

/* ===== Lesson list ===== */
.lesson-list {
  list-style: none;
  padding: 6px;
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lesson-list__item { border-radius: var(--radius-sm); }
.lesson-list__item + .lesson-list__item { margin-top: 2px; }
.lesson-list__link {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 16px 16px;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.lesson-list__link:hover { background: var(--bg-hover); text-decoration: none; }
.lesson-list__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: 'SF Mono', Monaco, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  flex: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lesson-list__link:hover .lesson-list__num {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
}
.lesson-list__body { flex: 1; min-width: 0; }
.lesson-list__body h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.lesson-list__body p { margin: 0; font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-list__meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-3); flex: none; }
.lesson-list__dur { font-family: 'SF Mono', Monaco, Menlo, monospace; font-size: 12px; }

/* ===== Lesson page ===== */
.lesson-page__header h1 { font-size: 27px; margin: 4px 0 4px; letter-spacing: -0.02em; }
.lesson-page__desc { color: var(--text-2); margin: 0 0 22px; font-size: 16px; max-width: 70ch; }
.lesson-page__grid { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; }
@media (max-width: 900px) { .lesson-page__grid { grid-template-columns: 1fr; } }
.player-frame {
  position: relative;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0,0,0,0.4);
}
.player-frame iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
.lesson-sidebar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}
.lesson-sidebar h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin: 4px 8px 12px; font-weight: 700; }
.lesson-sidebar__list { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.lesson-sidebar__list li { font-size: 14px; border-radius: var(--radius-sm); }
.lesson-sidebar__list a { color: var(--text-2); display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-radius: var(--radius-sm); transition: background 0.15s, color 0.15s; }
.lesson-sidebar__list a:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.lesson-sidebar__list a span { color: var(--text-3); font-family: 'SF Mono', Monaco, monospace; font-size: 12px; flex: none; }
.lesson-sidebar__list li.is-current a { color: var(--accent-dark); font-weight: 600; background: var(--accent-tint); }
.lesson-sidebar__list li.is-current a span { color: var(--accent-dark); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-accent); }
.btn--primary:hover { color: #fff; box-shadow: 0 18px 36px -10px rgba(229, 85, 42, 0.6); transform: translateY(-1px); }
.btn--ghost { border-color: var(--border-2); color: var(--text-2); background: var(--bg); }
.btn--ghost:hover { border-color: var(--text-3); color: var(--text); background: var(--bg-soft); }
.btn--danger { background: transparent; border-color: var(--border-2); color: var(--danger); }
.btn--danger:hover { background: #fdecea; border-color: var(--danger); }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--block { width: 100%; }

/* ===== Auth ===== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #15110E;
  background-image:
    radial-gradient(680px 480px at 78% 12%, rgba(255, 138, 91, 0.40), transparent 60%),
    radial-gradient(620px 520px at 12% 92%, rgba(229, 85, 42, 0.34), transparent 58%),
    radial-gradient(520px 420px at 50% 50%, rgba(255, 107, 53, 0.10), transparent 65%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at center, #000, transparent 75%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 40px 36px 34px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: cardIn 0.5s cubic-bezier(.2,.7,.2,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.auth-card__logo { display: block; height: 40px; width: auto; margin: 0 auto 8px; }
.auth-card__subtitle { text-align: center; color: var(--text-3); font-size: 12px; margin: 0 0 28px; letter-spacing: 0.10em; text-transform: uppercase; font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .btn--block { margin-top: 6px; padding: 13px; font-size: 15px; }

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.form label, .auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.form input, .form textarea, .form select,
.auth-form input {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input::placeholder, .auth-form input::placeholder { color: var(--text-3); }
.form input:focus, .form textarea:focus, .form select:focus, .auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.form .checkbox { flex-direction: row; align-items: center; gap: 9px; }
.form .checkbox input { width: auto; }

/* ===== Tables ===== */
.table-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table th { text-align: left; padding: 13px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--border-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 700; }
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover td { background: var(--bg-soft); }
/* avoid double border/shadow when wrapped */
.table-wrap .table { border: 0; border-radius: 0; box-shadow: none; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }
.ua { font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }

/* ===== Misc ===== */
.block { margin-top: 40px; }
.block h2 { font-size: 19px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.01em; }
.muted { color: var(--text-3); }
.empty {
  padding: 56px 32px;
  text-align: center;
  color: var(--text-3);
  background: var(--bg);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  font-size: 15px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.badge--ok { background: #E8F5F1; color: var(--ok); border-color: #C8E5DC; }
.badge--accent { background: var(--accent-tint); color: var(--accent-dark); border-color: #F4D2C2; }

.alert { padding: 13px 16px; border-radius: 11px; font-size: 14px; margin-bottom: 18px; font-weight: 500; }
.alert--error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2; }
.alert--info { background: var(--accent-tint); color: var(--accent-dark); border: 1px solid #f4d2c2; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; margin-bottom: 12px; }
.stat-card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,53,0.10), transparent 70%);
}
.stat-card__value { display: block; font-size: 34px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.stat-card__label { display: block; margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 600; }

.error-page { text-align: center; padding: 90px 24px; }
.error-page h1 { font-size: 30px; margin-bottom: 8px; letter-spacing: -0.02em; }
.error-page p { color: var(--text-2); margin-bottom: 26px; }

.footer { text-align: center; padding: 36px; color: var(--text-3); font-size: 12.5px; border-top: 1px solid var(--border); margin-top: 72px; }
.footer__sep { margin: 0 8px; opacity: 0.5; }
