:root {
  --ink: #19212a;
  --muted: #647084;
  --line: #dde6ee;
  --paper: #ffffff;
  --soft: #f5f8fb;
  --brand: #156f63;
  --brand-2: #0ea5a4;
  --warm: #f4b860;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(18, 31, 44, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(221, 230, 238, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 10px;
  font-weight: 800;
}

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

.brand small,
.eyebrow,
.lesson-row small,
.footer,
.muted {
  color: var(--muted);
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 700;
}

.navlinks form { margin: 0; }

.link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(21, 111, 99, 0.22);
  font-weight: 800;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.button-small {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
}

.button-ghost {
  color: var(--brand);
  background: #e6f4f1;
  box-shadow: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  min-height: calc(100vh - 72px);
  padding: clamp(40px, 7vw, 86px) clamp(18px, 5vw, 72px);
  background:
    linear-gradient(110deg, rgba(255,255,255,0.96), rgba(245,248,251,0.82)),
    url("data:image/svg+xml,%3Csvg width='1200' height='780' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='780' fill='%23e8f4f2'/%3E%3Cpath d='M0 620 C210 520 280 690 470 590 C650 495 750 360 980 420 C1100 451 1150 520 1200 498 L1200 780 L0 780 Z' fill='%23f8d99a'/%3E%3Cpath d='M730 90 L1160 90 L1160 360 L730 360 Z' fill='%23ffffff' opacity='.72'/%3E%3Cpath d='M805 150 L1080 150 M805 205 L1030 205 M805 260 L1100 260' stroke='%23156f63' stroke-width='18' stroke-linecap='round' opacity='.35'/%3E%3C/svg%3E");
  background-size: cover;
}

.hero h1,
.page-title h1,
.auth-panel h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(36px, 5.5vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-text {
  max-width: 720px;
  color: #3f4b5d;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 800;
}

.hero-actions,
.lesson-actions,
.row-title,
.panel-head,
.split {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-visual { display: flex; justify-content: center; }

.sheet-window {
  position: relative;
  width: min(100%, 560px);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.sheet-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.sheet-toolbar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--warm);
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cell {
  height: 44px;
  border-radius: 8px;
  background: #edf3f7;
  border: 1px solid #dce8ee;
}

.cell.active { background: #bbe7df; border-color: #71c8ba; }

.formula-card {
  position: absolute;
  right: -18px;
  bottom: 28px;
  max-width: 240px;
  padding: 16px;
  border-radius: 12px;
  background: #17232f;
  color: white;
  box-shadow: var(--shadow);
}

.formula-card small {
  display: block;
  margin-bottom: 5px;
  color: #b7c8d8;
}

.band,
.courses-preview,
.workspace,
.lesson-main,
.lesson-side {
  padding: clamp(28px, 5vw, 58px);
}

.band { background: white; }

.section-head {
  max-width: 780px;
  margin-bottom: 26px;
}

.section-head h2,
.module-block h2,
.lesson-main h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.method-grid,
.admin-grid,
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.method-grid article,
.stats-row article,
.course-card,
.auth-panel,
.note-panel,
.qa-panel,
.admin-tile,
.module-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(18, 31, 44, 0.07);
}

.method-grid article,
.stats-row article,
.admin-tile {
  padding: 22px;
}

.icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  border-radius: 10px;
  background: var(--brand);
  font-weight: 800;
}

.course-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 16px 0;
  padding: 24px;
}

.course-card.wide { max-width: 1100px; }

.progress {
  height: 10px;
  max-width: 440px;
  overflow: hidden;
  border-radius: 20px;
  background: #dfe9ef;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--warm));
}

.pill {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #77520c;
  background: #fff0ce;
  font-size: 12px;
  font-weight: 800;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 136px);
  padding: 32px 18px;
}

.auth-panel {
  width: min(100%, 520px);
  padding: clamp(26px, 5vw, 46px);
}

.auth-panel h1 { font-size: clamp(30px, 4vw, 46px); }

.form,
.editor-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfdce6;
  border-radius: 10px;
  background: white;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
}

textarea { resize: vertical; }

.alert,
.success,
.tip-box {
  padding: 13px 15px;
  border-radius: 10px;
}

.alert { color: var(--danger); background: #fff0ee; }
.success { color: #126149; background: #e8f7f0; }
.tip-box { color: #5d4309; background: #fff3d9; }

.subtle-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--brand);
  font-weight: 800;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 136px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 18px;
  background: #eaf1f4;
  border-right: 1px solid var(--line);
}

.sidebar.dark {
  color: white;
  background: #15222d;
  border-right: 0;
}

.sidebar a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #405064;
  font-weight: 800;
}

.sidebar.dark a { color: #cfdae5; }
.sidebar a.active,
.sidebar a:hover {
  color: var(--brand);
  background: white;
}

.page-title {
  margin-bottom: 24px;
}

.page-title h1 { font-size: clamp(32px, 4vw, 54px); }
.page-title p { color: var(--muted); }
.row-title { justify-content: space-between; }

.stats-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

.stats-row strong {
  display: block;
  font-size: 34px;
}

.stats-row span { color: var(--muted); }

.module-block {
  padding: 22px;
  margin-bottom: 18px;
}

.lesson-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.lesson-row.locked {
  opacity: 0.58;
  pointer-events: none;
}

.lesson-state {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.lesson-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 0;
  min-height: calc(100vh - 136px);
}

.lesson-main {
  background: white;
  min-width: 0;
}

.video-frame {
  position: relative;
  overflow: hidden;
  width: min(100%, 980px);
  margin: 18px 0 22px;
  border-radius: 14px;
  background: #0f1720;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 260px);
}

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

.lesson-content {
  max-width: 850px;
  font-size: 18px;
}

.downloads {
  margin: 24px 0;
}

.downloads a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 8px 6px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7fafc;
  font-weight: 800;
}

.downloads span {
  padding: 4px 7px;
  border-radius: 6px;
  color: white;
  background: var(--brand);
  font-size: 12px;
}

.lesson-side {
  display: grid;
  align-content: start;
  gap: 16px;
  background: #eef4f7;
  border-left: 1px solid var(--line);
  max-height: calc(100vh - 72px);
  overflow: auto;
  position: sticky;
  top: 72px;
}

.note-panel,
.qa-panel {
  padding: 20px;
}

.qa-wide {
  max-width: 980px;
  margin: 26px 0;
  box-shadow: none;
}

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

.note-panel textarea {
  min-height: 150px;
  margin-bottom: 12px;
}

.helper-note {
  margin: 10px 0 0;
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  color: var(--brand);
  background: #e6f4f1;
  font-size: 18px;
  cursor: pointer;
}

.message {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.message span {
  color: var(--muted);
  font-size: 12px;
}

.answer {
  margin-top: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #eefaf7;
}

.answer p {
  margin: 6px 0 0;
}

.qa-form {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.data-table {
  width: 100%;
  overflow: hidden;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.data-table th,
.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: #f7fafc;
  font-size: 13px;
  text-transform: uppercase;
}

.admin-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-tile {
  display: block;
  color: inherit;
}

.content-line {
  padding-top: 8px;
  color: var(--muted);
}

.module-summary {
  color: var(--ink);
}

.content-tools {
  margin: 6px 0 14px;
}

.module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-actions form {
  margin: 0;
}

.mini-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.mini-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}

.lesson-mini-title {
  flex: 1;
}

.mini-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-list .lesson-mini-title {
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
}

.mini-action {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}

.admin-course-card {
  align-items: flex-start;
}

.course-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 220px;
}

.narrow { max-width: 940px; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: white;
  font-size: 14px;
}

@media (max-width: 980px) {
  .hero,
  .app-layout,
  .lesson-shell {
    grid-template-columns: 1fr;
  }

  .hero { min-height: auto; }
  .sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .method-grid,
  .admin-grid,
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-side {
    border-left: 0;
    max-height: none;
    overflow: visible;
    position: static;
  }

  .video-frame {
    width: 100%;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar,
  .footer,
  .course-card,
  .row-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .navlinks { width: 100%; justify-content: space-between; }
  .method-grid,
  .admin-grid,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .lesson-row {
    grid-template-columns: 36px 1fr;
  }

  .lesson-row em { grid-column: 2; }
  .formula-card { position: static; margin-top: 16px; }
}
