:root {
  --wine: #8f000d;
  --deep-wine: #240308;
  --black: #111111;
  --ink: #141a2a;
  --muted: #7a8497;
  --line: #e5e9f1;
  --paper: #f5f7fb;
  --cream: #fbf5df;
  --gold: #e3d2ab;
  --white: #ffffff;
  --green: #c9fae5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 76% 24%, rgba(155, 35, 25, 0.55), transparent 28%),
    linear-gradient(135deg, #080808 0%, #220307 46%, #8f000d 100%);
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.brand {
  color: var(--white);
  position: absolute;
  top: 42px;
  left: 42px;
}

.brand-mark {
  font-size: 42px;
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: 10px;
}

.brand-sub {
  margin-top: 12px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 9px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #ccd5e3;
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 13px;
  font-weight: 750;
}

.field input:disabled {
  opacity: 1;
  color: var(--ink);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.primary-btn,
.ghost-btn,
.soft-btn,
.danger-btn {
  border: 0;
  border-radius: 7px;
  min-height: 46px;
  padding: 0 20px;
  font-weight: 900;
}

.primary-btn {
  color: var(--white);
  background: linear-gradient(90deg, #c60035, #8f0000);
  box-shadow: 0 12px 28px rgba(143, 0, 13, 0.22);
}

.danger-btn {
  color: var(--white);
  background: #8f000d;
}

.ghost-btn {
  color: #765e4c;
  background: var(--white);
  border: 1px solid var(--gold);
}

.soft-btn {
  color: var(--ink);
  background: #eef2f8;
  border: 1px solid #dbe2ee;
}

.login-actions {
  display: grid;
  gap: 12px;
}

.hint {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  color: #725f51;
  background: #fffaf0;
  font-size: 14px;
  line-height: 1.45;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 330px 74px 1fr;
}

.main-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 44px 32px 190px;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.96), rgba(36, 3, 8, 0.95) 44%, rgba(143, 0, 13, 0.97)),
    #160207;
}

.main-sidebar .brand-mark {
  font-size: 42px;
}

.main-sidebar .brand-sub {
  font-size: 17px;
}

.side-menu {
  display: grid;
  gap: 14px;
  margin-top: 58px;
}

.side-menu button {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 0 28px 28px 0;
  color: var(--white);
  background: transparent;
  text-align: left;
  font-weight: 900;
  font-size: 20px;
}

.side-menu button.active {
  background: linear-gradient(90deg, #c60035, #8e0710);
}

.user-pill {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 24px;
  padding-top: 14px;
  background: linear-gradient(180deg, rgba(104, 0, 10, 0), rgba(143, 0, 13, 0.94) 28%);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.avatar {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  color: #0582c7;
  background: #dff3ff;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-weight: 950;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.user-role {
  font-weight: 750;
  color: rgba(255, 255, 255, 0.72);
}

.account-tag {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  color: #8f000d;
  background: var(--white);
  font-weight: 950;
  text-align: left;
  padding: 0 10px;
}

.icon-rail {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-top: 28px;
  background: linear-gradient(180deg, #100d0e, #210305);
}

.rail-logo,
.rail-btn {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: transparent;
  font-weight: 950;
}

.rail-logo {
  background: #333;
}

.rail-btn.active {
  background: rgba(255, 255, 255, 0.18);
}

.content {
  min-width: 0;
}

.auto-save {
  height: 84px;
  display: flex;
  align-items: end;
  padding: 0 64px 18px;
  color: #9b9186;
  background: var(--cream);
  border-bottom: 1px solid #eadfbe;
  font-weight: 760;
  font-size: 18px;
}

.topbar {
  min-height: 86px;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 520px);
  gap: 32px;
  align-items: center;
  padding: 0 64px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
}

.topbar p {
  margin: 2px 0 0;
  color: #758197;
  font-weight: 850;
}

.search {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  color: var(--ink);
  background: #f0f2f7;
  font-weight: 900;
  font-size: 18px;
}

.page {
  width: 100%;
  max-width: 1280px;
  padding: 54px clamp(28px, 5vw, 76px) 84px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 36px;
}

.page-title h2 {
  margin: 0;
  font-size: 34px;
}

.page-title p {
  margin: 12px 0 0;
  color: #aaa19d;
  font-size: 19px;
  font-weight: 750;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 34px;
}

.course-card {
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.course-cover,
.module-card,
.mini-cover {
  background:
    radial-gradient(circle at 76% 35%, rgba(183, 76, 56, 0.72), transparent 28%),
    linear-gradient(135deg, #050505 0%, #250407 48%, #8f000d 100%);
}

.course-cover {
  height: 210px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 24px;
  color: var(--white);
  box-shadow: 0 22px 50px rgba(16, 23, 35, 0.1);
}

.course-cover strong {
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.cover-line {
  height: 6px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.course-card h3 {
  margin: 20px 0 10px;
  color: var(--ink);
  font-size: 24px;
  overflow-wrap: anywhere;
}

.course-card p {
  margin: 0;
  color: #758197;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 800;
}

.hero-course {
  min-height: 365px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 46px;
  padding: clamp(32px, 4vw, 54px);
  border-radius: 8px;
  color: var(--white);
  background:
    radial-gradient(circle at 88% 22%, rgba(196, 78, 60, 0.7), transparent 32%),
    linear-gradient(135deg, #030303, #230306 52%, #8f000d);
}

.hero-course h2 {
  margin: 0 0 16px;
  font-size: 38px;
}

.hero-course p {
  max-width: 710px;
  margin: 0 0 26px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 760;
}

.content-count {
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 950;
}

.hero-progress {
  width: min(420px, 100%);
  height: 7px;
  margin-bottom: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

.hero-progress div {
  height: 100%;
  border-radius: 999px;
  background: #c60035;
}

.wide-btn {
  width: min(100%, 980px);
}

.modules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0 0 44px;
}

.module-card {
  width: 250px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 24px;
  border-radius: 8px;
  color: var(--white);
}

.module-card strong {
  font-size: 23px;
  overflow-wrap: anywhere;
}

.course-admin-actions,
.module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.module-actions {
  display: grid;
  align-items: start;
}

.module-actions .ghost-btn {
  min-height: 36px;
  padding: 0 12px;
}

.icon-only {
  width: 44px;
  padding: 0;
}

.danger-text {
  color: #a00014;
  border-color: #f1c3ca;
}

.module-section {
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

.module-section + .module-section {
  margin-top: 28px;
}

.module-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.module-section-head h2 {
  margin: 0;
  font-size: 30px;
}

.lesson-list {
  overflow: hidden;
  border-radius: 8px;
  background: var(--white);
}

.lesson-row {
  display: grid;
  grid-template-columns: 34px minmax(96px, 150px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 104px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.lesson-row-admin {
  grid-template-columns: 48px 34px minmax(96px, 150px) minmax(0, 1fr) minmax(220px, auto);
}

.lesson-row:last-child {
  border-bottom: 0;
}

.status-dot {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: #08a466;
  font-weight: 950;
}

.mini-cover {
  height: 70px;
  border-radius: 7px;
}

.lesson-title {
  min-width: 0;
  font-size: 20px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.lesson-title span {
  display: inline;
  font-weight: 650;
}

.lesson-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.lesson-actions .ghost-btn {
  min-height: 40px;
  padding: 0 14px;
}

.lesson-page {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(300px, 430px);
  gap: 40px;
  align-items: start;
}

.video-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.reading-frame {
  width: 100%;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 22px;
  padding: 48px;
  border-radius: 8px;
  color: var(--white);
  background:
    radial-gradient(circle at 76% 35%, rgba(183, 76, 56, 0.72), transparent 28%),
    linear-gradient(135deg, #280306 0%, #5d0009 52%, #b00018 100%);
}

.reading-frame span {
  font-weight: 850;
  font-size: 18px;
}

.reading-frame strong {
  font-size: clamp(34px, 4vw, 48px);
}

.lesson-open h2 {
  margin: 34px 0 22px;
  color: #282323;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.13;
}

.empty-copy {
  color: #b3a8a1;
  font-size: 18px;
  font-weight: 800;
}

.panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  min-width: 0;
  overflow: hidden;
}

.panel h3 {
  margin: 0 0 20px;
  font-size: 26px;
}

.panel-actions {
  display: grid;
  gap: 14px;
}

.lesson-progress-line {
  height: 7px;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee6d9;
}

.lesson-progress-line span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #a00014;
}

.comment-form {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.comment-form input {
  min-width: 0;
  flex: 1;
  min-height: 52px;
  border: 1px solid #ccd5e3;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
}

.comment-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  background: var(--white);
  font-size: 18px;
}

.profile-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 44px;
  align-items: start;
}

.profile-summary {
  display: grid;
  place-items: center;
  min-height: 420px;
  text-align: center;
  min-width: 0;
}

.profile-summary .avatar {
  width: 112px;
  height: 112px;
  margin-bottom: 28px;
  font-size: 34px;
}

.profile-summary h2 {
  margin: 0 0 22px;
  font-size: 28px;
  overflow-wrap: anywhere;
}

.profile-summary p {
  margin: 0;
  color: #aaa19d;
  font-size: 20px;
  font-weight: 800;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  width: 100%;
  margin-top: 34px;
}

.stat {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  text-align: left;
}

.stat small {
  color: #867265;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: normal;
}

.stat strong {
  display: block;
  margin-top: 18px;
  font-size: 38px;
}

.form-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  min-width: 0;
  overflow: hidden;
}

.form-card h3 {
  margin: 0 0 22px;
  font-size: 24px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(17, 10, 10, 0.62);
}

.modal-card {
  position: relative;
  width: min(100%, 980px);
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: clamp(28px, 4vw, 52px);
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.25);
}

.modal-card h2 {
  margin: 0 0 34px;
  font-size: 34px;
}

.modal-close {
  position: absolute;
  top: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: #4b403d;
  background: var(--white);
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 34px;
}

.ranking-list,
.audit-list,
.client-list,
.access-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.ranking-row,
.audit-row,
.client-row {
  display: grid;
  align-items: center;
  gap: 24px;
  min-height: 92px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}

.ranking-row {
  grid-template-columns: 48px 68px 1fr auto;
}

.audit-row {
  grid-template-columns: 1fr auto;
}

.client-row {
  grid-template-columns: 1fr auto;
}

.client-credentials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  color: #75675e;
  font-weight: 800;
}

.client-actions,
.client-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.client-form-actions {
  justify-content: flex-start;
  margin-top: 18px;
}

.ranking-row:last-child,
.audit-row:last-child,
.client-row:last-child {
  border-bottom: 0;
}

.rank-number,
.xp {
  font-size: 21px;
  font-weight: 950;
}

.access-card {
  margin-bottom: 18px;
  padding: 0 24px;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(150px, auto));
  gap: 18px;
  align-items: center;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
}

.access-row:last-child {
  border-bottom: 0;
}

.access-row.child {
  padding-left: 20px;
}

.access-row.lesson-access {
  padding-left: 42px;
}

.access-row strong,
.access-row label {
  font-size: 18px;
  font-weight: 900;
}

.access-row span {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-weight: 700;
}

.progress-block {
  display: grid;
  gap: 18px;
}

.progress-item {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: #75675e;
  font-weight: 900;
}

.progress-bar {
  height: 30px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee6d9;
}

.progress-fill {
  height: 100%;
  width: var(--value);
  background: #a00014;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 34px;
}

.admin-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.admin-card small {
  color: #82756d;
  font-weight: 850;
}

.admin-card strong {
  display: block;
  margin-top: 14px;
  font-size: 36px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 260px 64px 1fr;
  }

  .main-sidebar {
    padding-left: 24px;
    padding-right: 24px;
  }

  .page {
    padding: 42px 36px 70px;
  }

  .topbar {
    padding: 0 36px;
  }

  .lesson-page,
  .profile-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .lesson-row-admin {
    grid-template-columns: 44px 30px 110px minmax(0, 1fr);
  }

  .lesson-row-admin .lesson-actions {
    grid-column: 4;
    justify-content: flex-start;
  }

  .access-row {
    grid-template-columns: 1fr 1fr;
    padding: 18px 0;
  }
}

@media (max-width: 760px) {
  .brand {
    display: none;
  }

  .shell {
    display: block;
  }

  .main-sidebar {
    position: relative;
    height: auto;
    padding: 24px;
  }

  .side-menu {
    margin-top: 28px;
    gap: 8px;
  }

  .side-menu button {
    min-height: 42px;
    font-size: 17px;
  }

  .user-pill {
    position: static;
    margin-top: 28px;
  }

  .icon-rail {
    position: sticky;
    top: 0;
    height: 62px;
    flex-direction: row;
    padding: 4px 12px;
    overflow-x: auto;
  }

  .rail-logo,
  .rail-btn {
    min-width: 48px;
    width: 48px;
    height: 48px;
  }

  .auto-save {
    height: 54px;
    padding: 0 20px 12px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 18px 20px;
  }

  .page {
    padding: 34px 20px 60px;
  }

  .page-title,
  .modules-head {
    display: grid;
  }

  .lesson-row {
    grid-template-columns: 26px 90px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .lesson-row-admin {
    grid-template-columns: 40px 26px minmax(0, 1fr);
  }

  .lesson-row-admin .mini-cover {
    grid-column: 2 / 4;
    width: 100%;
  }

  .lesson-row-admin .lesson-title,
  .lesson-row-admin .lesson-actions {
    grid-column: 1 / -1;
  }

  .lesson-row .lesson-actions,
  .lesson-row .ghost-btn {
    grid-column: 3;
    width: 100%;
  }

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

  .comment-form {
    display: grid;
  }

  .stats,
  .admin-cards {
    grid-template-columns: 1fr;
  }

  .access-row {
    grid-template-columns: 1fr;
  }

  .access-row.child,
  .access-row.lesson-access {
    padding-left: 0;
  }

  .ranking-row {
    grid-template-columns: 30px 52px 1fr;
  }

  .xp {
    grid-column: 3;
  }
}
