:root {
  --cream: #f4f0e9;
  --paper: #fffdf9;
  --forest: #173f36;
  --forest-deep: #0b2d26;
  --ochre: #c99521;
  --ochre-soft: #ead8ac;
  --ink: #1b2622;
  --muted: #6e7772;
  --line: rgba(23, 63, 54, .14);
  --danger: #a63d4b;
  --success: #28795f;
  --shadow: 0 24px 70px rgba(24, 48, 40, .12);
  font-family: "Nunito Sans", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { min-height: 100vh; margin: 0; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.page-loader {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--forest);
}

.page-loader span {
  width: 40px;
  height: 40px;
  border: 2px solid var(--ochre-soft);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.page-loader p { margin: 16px 0 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 47%) 1fr;
  background: var(--paper);
}

.auth-art {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(30px, 5vw, 74px);
  color: #fff;
  background:
    radial-gradient(circle at 76% 16%, rgba(232, 198, 117, .75), transparent 25%),
    radial-gradient(circle at 12% 86%, rgba(255, 255, 255, .18), transparent 30%),
    linear-gradient(145deg, #092c26 0%, #285a4d 55%, #b68832 150%);
  isolation: isolate;
}

.auth-art::before,
.auth-art::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 50%;
  z-index: -1;
}

.auth-art::before { width: 52vw; height: 52vw; left: -29vw; bottom: -16vw; }
.auth-art::after { width: 32vw; height: 32vw; right: -18vw; top: 28%; }

.auth-brand,
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 850;
  letter-spacing: -.035em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  letter-spacing: .04em;
}

.auth-art__copy { position: absolute; left: clamp(30px, 5vw, 74px); right: clamp(30px, 5vw, 74px); bottom: 10%; }
.auth-art__eyebrow { margin: 0 0 20px; color: #f1d898; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.auth-art h2 { max-width: 670px; margin: 0; font-size: clamp(38px, 5vw, 76px); font-weight: 350; line-height: .98; letter-spacing: -.055em; }
.auth-art p:last-child { max-width: 520px; margin: 28px 0 0; color: rgba(255, 255, 255, .72); font-size: 17px; line-height: 1.65; }

.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 40px clamp(24px, 7vw, 120px); }
.auth-card { width: min(430px, 100%); animation: rise .55s ease both; }
.auth-card h1 { margin: 0; color: var(--forest); font-size: clamp(36px, 4vw, 54px); font-weight: 450; line-height: 1.08; letter-spacing: -.045em; }
.auth-card > p { margin: 14px 0 34px; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field span { color: var(--forest); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 15px 16px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--ochre); box-shadow: 0 0 0 4px rgba(201, 149, 33, .12); }

.primary,
.secondary,
.text-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.primary { width: 100%; padding: 15px 24px; color: #fff; background: var(--forest); box-shadow: 0 12px 24px rgba(23, 63, 54, .18); }
.primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(23, 63, 54, .24); }
.primary:disabled { cursor: wait; opacity: .65; transform: none; }
.secondary { padding: 11px 18px; color: var(--forest); background: var(--ochre-soft); }
.text-button { padding: 8px 0; color: var(--forest); background: transparent; }
.danger-button { padding: 10px 17px; color: var(--danger); background: #f9e9eb; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 18px; }
.auth-actions a { color: var(--forest); font-size: 14px; font-weight: 750; text-decoration: none; }
.demo-note { margin-top: 26px; padding: 14px 16px; border-left: 3px solid var(--ochre); background: #fbf7ee; color: var(--muted); font-size: 13px; line-height: 1.55; }
.form-error { min-height: 22px; margin: 12px 0; color: var(--danger); font-size: 14px; }

.cabinet { min-height: 100vh; background: radial-gradient(circle at 92% 0, rgba(234, 216, 172, .48), transparent 29%), var(--cream); }
.cabinet-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 14px clamp(20px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(244, 240, 233, .9); backdrop-filter: blur(18px); }
.cabinet-header .brand { color: var(--forest); }
.cabinet-user { display: flex; align-items: center; gap: 14px; }
.cabinet-user__avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; background: var(--forest); font-weight: 900; }
.cabinet-user__name { font-size: 14px; font-weight: 800; }
.cabinet-user__email { color: var(--muted); font-size: 12px; }

.cabinet-grid { display: grid; grid-template-columns: 238px minmax(0, 1fr); width: min(1480px, 100%); min-height: calc(100vh - 78px); margin: 0 auto; }
.cabinet-nav { padding: 34px 22px; border-right: 1px solid var(--line); }
.cabinet-nav__label { margin: 0 12px 15px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.cabinet-nav a { display: flex; align-items: center; gap: 11px; margin: 3px 0; padding: 12px 14px; border-radius: 12px; color: #43514c; text-decoration: none; font-size: 14px; font-weight: 750; transition: .2s; }
.cabinet-nav a:hover { color: var(--forest); background: rgba(255, 255, 255, .58); }
.cabinet-nav a.is-active { color: #fff; background: var(--forest); box-shadow: 0 10px 28px rgba(23, 63, 54, .16); }
.cabinet-nav svg { width: 18px; height: 18px; }

.cabinet-main { min-width: 0; padding: clamp(30px, 5vw, 70px); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-heading__eyebrow { margin: 0 0 8px; color: var(--ochre); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.page-heading h1 { margin: 0; color: var(--forest); font-size: clamp(36px, 5vw, 62px); font-weight: 420; letter-spacing: -.055em; line-height: 1; }
.page-heading p { max-width: 590px; margin: 14px 0 0; color: var(--muted); line-height: 1.6; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.stat { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255, 253, 249, .72); }
.stat strong { display: block; color: var(--forest); font-size: 30px; font-weight: 500; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 13px; }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 14px 46px rgba(31, 51, 43, .06); overflow: hidden; animation: rise .45s ease both; }
.card__body { padding: 24px; }
.card__eyebrow { color: var(--ochre); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.card h2, .card h3 { margin: 9px 0; color: var(--forest); font-weight: 550; letter-spacing: -.025em; }
.card h2 { font-size: 25px; }
.card h3 { font-size: 19px; }
.card p { color: var(--muted); line-height: 1.6; }
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 24px; border-top: 1px solid var(--line); background: #faf7f1; }

.progress { height: 7px; overflow: hidden; border-radius: 99px; background: #e7e2da; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ochre), #e4bf65); }
.progress-label { display: flex; justify-content: space-between; margin: 13px 0 8px; color: var(--muted); font-size: 12px; }

.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 38%); gap: 22px; align-items: start; }
.lesson-list { display: grid; gap: 12px; }
.block-title { margin: 28px 0 10px; color: var(--forest); font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.lesson { display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: center; width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 16px; color: inherit; background: var(--paper); text-align: left; cursor: pointer; }
.lesson:hover, .lesson.is-active { border-color: var(--ochre); transform: translateY(-1px); }
.lesson__number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--forest); background: var(--ochre-soft); font-weight: 900; }
.lesson__title { display: block; color: var(--forest); font-weight: 850; }
.lesson__summary { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.lesson__progress { color: var(--success); font-size: 12px; font-weight: 800; }
.lesson-view { position: sticky; top: 108px; padding: 25px; border-radius: 22px; color: #fff; background: var(--forest); box-shadow: var(--shadow); }
.lesson-view h2 { margin: 10px 0; font-size: 28px; font-weight: 500; }
.lesson-view p { color: rgba(255,255,255,.7); line-height: 1.6; }
.video-placeholder { display: grid; place-items: center; aspect-ratio: 16/9; margin: 20px 0; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: linear-gradient(145deg, #0c2e28, #275a4d); }
.video-placeholder span { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; font-size: 24px; }

.profile-form, .panel { padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 14px 46px rgba(31, 51, 43, .05); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.form-grid .span-2 { grid-column: span 2; }

.file-list, .test-list, .cart-list { display: grid; gap: 12px; }
.file-row, .test-row, .cart-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); }
.file-row strong, .test-row strong, .cart-row strong { display: block; color: var(--forest); }
.file-row small, .test-row small, .cart-row small { color: var(--muted); }
.price { white-space: nowrap; color: var(--forest); font-size: 20px; font-weight: 900; }
.price s { display: block; color: #9a9e9b; font-size: 12px; font-weight: 500; }

.empty { padding: 50px 24px; border: 1px dashed rgba(23, 63, 54, .25); border-radius: 22px; color: var(--muted); text-align: center; background: rgba(255,255,255,.4); }
.empty strong { display: block; margin-bottom: 8px; color: var(--forest); font-size: 22px; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px; }
.product { display: flex; flex-direction: column; min-height: 250px; padding: 22px; border-radius: 20px; color: #fff; background: linear-gradient(145deg, var(--forest), #306b5b); }
.product:nth-child(2n) { color: var(--forest-deep); background: linear-gradient(145deg, #f0dfb6, #d8b964); }
.product h3 { margin: 10px 0; font-size: 20px; line-height: 1.15; }
.product .button-row { margin-top: auto; }
.product .secondary { background: rgba(255,255,255,.88); }

.order-total { display: flex; justify-content: space-between; gap: 20px; margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--forest); font-size: 24px; font-weight: 900; }
.success-panel { max-width: 680px; margin: 8vh auto; padding: clamp(35px, 7vw, 76px); border-radius: 28px; color: #fff; background: var(--forest); text-align: center; box-shadow: var(--shadow); }
.success-panel__mark { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 24px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; color: #f1d898; font-size: 34px; }
.success-panel h1 { margin: 0; font-size: clamp(35px, 6vw, 60px); font-weight: 420; letter-spacing: -.05em; }
.success-panel p { color: rgba(255,255,255,.72); line-height: 1.6; }

.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 390px; padding: 14px 18px; border-radius: 14px; color: #fff; background: var(--forest); box-shadow: var(--shadow); animation: rise .25s ease both; }
.toast.is-error { background: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { min-height: 32vh; }
  .auth-art__copy { position: relative; left: auto; right: auto; bottom: auto; margin-top: 10vh; }
  .auth-art p:last-child { display: none; }
  .auth-panel { min-height: 68vh; }
  .cabinet-grid { grid-template-columns: 1fr; }
  .cabinet-nav { position: sticky; top: 78px; z-index: 18; display: flex; gap: 5px; overflow-x: auto; padding: 10px 18px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(244,240,233,.94); backdrop-filter: blur(18px); }
  .cabinet-nav__label { display: none; }
  .cabinet-nav a { flex: 0 0 auto; }
  .course-layout { grid-template-columns: 1fr; }
  .lesson-view { position: static; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .auth-art { min-height: 260px; }
  .auth-art h2 { font-size: 38px; }
  .auth-panel { padding: 38px 22px 60px; }
  .cabinet-header { min-height: 68px; padding: 10px 16px; }
  .cabinet-header .brand > span:last-child, .cabinet-user__meta { display: none; }
  .cabinet-nav { top: 68px; }
  .cabinet-nav a { padding: 10px 12px; font-size: 12px; }
  .cabinet-main { padding: 30px 18px 60px; }
  .page-heading { align-items: start; flex-direction: column; }
  .stats, .card-grid, .product-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .file-row, .test-row, .cart-row { align-items: flex-start; flex-direction: column; }
  .lesson { grid-template-columns: 38px 1fr; }
  .lesson__progress { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
