@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #777777;
  --line: #e8e8e5;

  --accent: #b7ff00;
  --accent-dark: #171717;

  --soft: #f0f5df;
  --danger: #d94b4b;
  --success: #26834d;

  --primary: #b7ff00;
  --border: #e8e8e5;
  --text: #171717;

  --radius: 18px;
  --shadow: 0 12px 35px rgba(0, 0, 0, .055);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.55 "DM Sans", sans-serif;
}

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

button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(133, 183, 61, .28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 27px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  margin-bottom: 44px;
  font: 800 21px "Manrope", sans-serif;
  letter-spacing: -1px;
}


.brand span { color: #87917e; }

.nav-label {
  margin: 0 10px 9px;
  color: #a1a69e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nav-list { display: grid; gap: 5px; }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 11px;
  color: #737a70;
  background: transparent;
  text-align: left;
  font-weight: 600;
  transition: .18s ease;
}

.nav-item:hover { background: #f7f8f5; color: var(--ink); }
.nav-item.active {
  color: #205b43;
  background: #e5f5e9;
  box-shadow: inset 3px 0 0 #35a875;
}

.nav-item:hover {
  background: #f0f8f3;
  color: #205b43;
}

.nav-item.active .nav-glyph {
  color: #269767;
}


.nav-glyph {
  width: 22px;
  color: #81897a;
  text-align: center;
  font-size: 17px;
  line-height: 1;
}

.nav-item.active .nav-glyph { color: #527a2e; }

.sidebar-bottom {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-bottom strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
}

.workspace { min-width: 0; }

.topbar {
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 54px);
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid var(--line);
}

.breadcrumb { color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.status {
  padding: 6px 10px;
  color: #526b39;
  background: #eff5e5;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e9eee1;
  color: #526b39;
  font-size: 12px;
  font-weight: 800;
}

main {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 34px clamp(22px, 4vw, 54px) 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}

.kicker {
  margin: 0 0 6px;
  color: #87917e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  font-family: "Manrope", sans-serif;
  letter-spacing: -.55px;
}

h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 36px); line-height: 1.2; }
h2 { margin-bottom: 12px; font-size: 21px; }
h3 { margin-bottom: 9px; font-size: 16px; }

.subtitle { max-width: 650px; margin: 0; color: var(--muted); }

.card {
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 245px;
  padding: clamp(25px, 5vw, 48px);
  border-radius: 24px;
  background: var(--accent);
}

.hero::after {
  content: "A";
  position: absolute;
  top: -89px;
  right: 10%;
  color: rgba(31, 55, 13, .07);
  font: 800 310px/1 "Manrope", sans-serif;
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 600px; }
.hero .kicker { color: #506936; }
.hero h1 { max-width: 550px; font-size: clamp(30px, 4vw, 47px); }
.hero p { max-width: 510px; margin-bottom: 22px; color: #4c5942; }

.hero-side {
  position: relative;
  z-index: 1;
  min-width: 140px;
  padding: 18px;
  border: 1px solid rgba(39, 61, 23, .12);
  border-radius: 16px;
  background: rgba(255,255,255,.38);
}

.hero-side strong {
  display: block;
  font: 800 30px "Manrope", sans-serif;
}

.hero-side span { color: #59694a; font-size: 12px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  transition: .18s ease;
}

.button:hover { transform: translateY(-1px); border-color: #cbd3c4; }
.button.primary { color: white; border-color: #253a16; background: #253a16; }
.button.primary:hover { background: #344b22; }
.button.lime { color: var(--accent-dark); border-color: var(--accent); background: var(--accent); }
.button.danger { color: var(--danger); border-color: #f0d7d7; background: #fff; }
.button.ghost { border-color: transparent; background: transparent; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
  margin: 17px 0 31px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.stat-symbol {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #557a34;
  background: #f0f4e9;
  font-size: 19px;
  font-weight: 700;
}

.stat-card strong { display: block; font: 800 20px "Manrope", sans-serif; }
.stat-card span { color: var(--muted); font-size: 12px; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 29px 0 14px;
}

.section-heading h2 { margin: 0; }
.muted { color: var(--muted); }

.course-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 15px;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.lesson-row:last-child { border-bottom: 0; padding-bottom: 0; }
.lesson-index {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #547333;
  background: #f0f4e9;
  font-size: 12px;
  font-weight: 800;
}
.lesson-row-info { flex: 1; min-width: 0; }
.lesson-row-info strong { display: block; }
.lesson-row-info span { color: var(--muted); font-size: 12px; }

.word-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.word-row:last-child { border-bottom: 0; }
.word-row span { color: var(--muted); }

.select-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin: 18px 0;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #626a5e;
  font-size: 12px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: white;
}

input:focus, select:focus, textarea:focus { border-color: #9dbb76; }
textarea { min-height: 130px; resize: vertical; line-height: 1.65; }

.learning-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 15px;
  align-items: start;
}

.lesson-meta {
  position: sticky;
  top: 20px;
}

.lesson-meta .pill { margin-bottom: 13px; }
.pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 30px;
  color: #557334;
  background: #f0f4e9;
  font-size: 11px;
  font-weight: 800;
}

.theory {
  white-space: pre-wrap;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbf8;
  line-height: 1.8;
}

.exercise {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.exercise:first-child { border-top: 0; }
.exercise p { margin-bottom: 11px; font-weight: 700; }

.answer-list { display: grid; gap: 8px; }
.answer-option {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: white;
  text-align: left;
  transition: .15s ease;
}
.answer-option:hover:not(:disabled) { border-color: #9dbb76; background: #fbfcf9; }
.answer-option.correct { border-color: #88c5aa; color: #176d4f; background: #eff8f3; }
.answer-option.incorrect { border-color: #e4a1a1; color: #a63c3c; background: #fff4f4; }
.answer-option:disabled { cursor: default; }

.feedback { min-height: 22px; margin-top: 8px; font-size: 13px; font-weight: 700; }
.feedback.success { color: var(--success); }
.feedback.error { color: var(--danger); }

.admin-selectors {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgb(0, 0, 0);
  box-shadow: var(--shadow);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(270px, .85fr) minmax(0, 1.4fr);
  gap: 15px;
  align-items: start;
  margin-top: 15px;
}

.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.divider { height: 1px; margin: 18px 0; background: var(--line); }

.exercise-list { display: grid; gap: 8px; margin: 12px 0 18px; }
.exercise-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #000;
}
.exercise-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.exercise-item.active { background: #000; }

.inline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.empty {
  padding: 25px;
  border: 1px dashed #d9dfd2;
  border-radius: 13px;
  color: var(--muted);
  background: #fbfcfa;
  text-align: center;
}
.empty strong { display: block; margin-bottom: 5px; color: var(--ink); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  padding: 11px 15px;
  border-radius: 10px;
  color: white;
  background: #253a16;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .learning-layout { grid-template-columns: 1fr; }
  .lesson-meta { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 13px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin: 0 0 12px; }
  .nav-label, .sidebar-bottom { display: none; }
  .nav-list { display: flex; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; }
  .topbar { height: 58px; padding: 0 17px; }
  main { padding: 24px 16px 42px; }
  .hero { min-height: 220px; }
  .hero-side { display: none; }
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .course-grid { grid-template-columns: 1fr; }
  .select-grid { grid-template-columns: 1fr 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}

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

.theory-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.theory-block {
  padding: 18px;
  margin: 12px 0;
}

.theory-block textarea {
  width: 100%;
  resize: vertical;
}

.theory-block input,
.theory-block textarea {
  box-sizing: border-box;
}

.theory-editor .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.theory-page {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.theory-page h3 {
  margin-bottom: 18px;
}

.theory-heading {
  margin: 20px 0 10px;
}

.theory-text {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 12px 0;
}

.theory-example,
.theory-note {
  padding: 16px;
  margin: 16px 0;
  border-radius: 12px;
  background: var(--surface);
  line-height: 1.7;
}

.theory-example strong,
.theory-note strong {
  display: block;
  margin-bottom: 8px;
}

.theory-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

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

.theory-table td {
  border: 1px solid var(--border);
  padding: 10px;
}


.theory-example > div,
.theory-note > div {
  white-space: pre-wrap;
  line-height: 1.7;
}


.format-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.theory-bullet {
  padding-left: 22px;
  text-indent: -14px;
  line-height: 1.7;
}

.theory-text strong,
.theory-example strong,
.theory-note strong {
  font-weight: 700;
}

.theory-text em,
.theory-example em,
.theory-note em {
  font-style: italic;
}


.theory-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 28px 0 10px;
}

.theory-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.theory-dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.theory-dot.active {
  background: var(--primary);
  transform: scale(1.3);
}

.theory-arrow {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  padding: 0;

  border: 1px solid var(--border);
  border-radius: 50%;

  background: var(--surface);
  color: var(--text);

  font-size: 25px;
  font-weight: 400;
  line-height: 1;

  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.theory-arrow:not(:disabled):hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.theory-arrow:not(:disabled):active {
  transform: scale(0.95);
}

.theory-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}.theory-arrow {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;
  padding: 0;

  border: 1px solid #35a875;
  border-radius: 50%;

  background: #35a875;
  color: white;

  font-size: 25px;
  font-weight: 400;
  line-height: 1;

  cursor: pointer;
  transition: all 0.2s ease;
}

.theory-arrow:not(:disabled):hover {
  background: #27865d;
  border-color: #27865d;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(53, 168, 117, 0.25);
}

.theory-arrow:not(:disabled):active {
  transform: scale(0.95);
}

.theory-arrow:disabled {
  background: #dceee5;
  border-color: #dceee5;
  color: #8eaa9b;
  opacity: 0.7;
  cursor: default;
  box-shadow: none;
}

.theory-editable {
  min-height: 110px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  outline: none;
}

.theory-editable:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(53, 168, 117, 0.12);
}

.theory-editable:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}

.theory-editable ul,
.theory-editable ol {
  padding-left: 24px;
}

/* Forma — fresh visual style */

.card,
.stat-card,
.admin-selectors {
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover,
.stat-card:hover {
  box-shadow: 0 16px 38px rgba(35, 75, 53, .10);
}

.stat-symbol {
  color: #21865e;
  background: #e3f6e9;
}

.stat-card:nth-child(2) .stat-symbol {
  color: #168e91;
  background: #e0f5f3;
}

.stat-card:nth-child(3) .stat-symbol {
  color: #a77b19;
  background: #fff5d9;
}

.lesson-index {
  color: #21865e;
  background: #e5f5e9;
}

.lesson-row:nth-child(even) .lesson-index {
  color: #168e91;
  background: #e0f5f3;
}

.pill {
  color: #21865e;
  background: #e5f5e9;
}

.status {
  color: #21865e;
  background: #e5f5e9;
}



body {
  background: var(--bg);
  color: #171717;
}


.brand span {
  color: #777;
}


.sidebar {
  background: #fff;
  border-right-color: #e8e8e5;
}

.nav-item {
  border-radius: 10px;
}

.nav-item:hover {
  color: #171717;
  background: #f3f3f1;
}

.nav-item.active {
  color: #171717;
  background: #efffcf;
  box-shadow: inset 3px 0 0 #b7ff00;
}

.nav-item.active .nav-glyph {
  color: #171717;
}


.topbar {
  background: rgba(255, 255, 255, .9);
  border-bottom-color: #e8e8e5;
}

.status {
  color: #171717;
  background: #efffcf;
}

.avatar {
  color: #171717;
  background: #b7ff00;
}


h1, h2, h3 {
  color: #171717;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
}

.kicker {
  color: #6c8e19;
}


.hero {
  background: #171717;
  color: #fff;
  border-radius: 22px;
}

.hero h1 {
  color: #fff;
}

.hero .kicker {
  color: #b7ff00;
}

.hero p {
  color: #d0d0d0;
}

.hero::after {
  color: rgba(183, 255, 0, .09);
}

.hero-side {
  color: #171717;
  background: #b7ff00;
  border-color: #b7ff00;
}

.hero-side span {
  color: #343434;
}


.button {
  border-radius: 10px;
  transition: .2s ease;
}

.button.primary {
  color: #171717;
  border-color: #b7ff00;
  background: #b7ff00;
  box-shadow: 0 4px 14px rgba(183, 255, 0, .2);
}

.button.primary:hover {
  color: #171717;
  background: #a4e600;
  border-color: #a4e600;
  box-shadow: 0 6px 18px rgba(183, 255, 0, .3);
}

.button.lime {
  color: #171717;
  border-color: #b7ff00;
  background: #b7ff00;
}

.button.lime:hover {
  background: #a4e600;
  border-color: #a4e600;
}

.button.ghost:hover {
  background: #f0f0ed;
}


.card,
.stat-card,
.admin-selectors {
  border-color: #e8e8e5;
  background: #fff;
  transition: .2s ease;
}

.card:hover,
.stat-card:hover {
  box-shadow: 0 16px 38px rgba(0, 0, 0, .08);
}


.stat-symbol {
  color: #171717;
  background: #efffcf;
}

.stat-card:nth-child(2) .stat-symbol {
  color: #171717;
  background: #e8f4ff;
}

.stat-card:nth-child(3) .stat-symbol {
  color: #171717;
  background: #fff2d6;
}


.lesson-index {
  color: #171717;
  background: #efffcf;
}

.lesson-row:nth-child(even) .lesson-index {
  background: #e8f4ff;
}


.pill {
  color: #263800;
  background: #efffcf;
}

.section-heading {
  border-color: #e8e8e5;
}


input:focus,
select:focus,
textarea:focus {
  border-color: #9bd900;
  box-shadow: 0 0 0 3px rgba(183, 255, 0, .13);
}


.theory {
  background: #fafaf8;
  border-color: #e8e8e5;
}

.theory-heading {
  color: #171717;
  border-left: 4px solid #b7ff00;
  padding-left: 11px;
}

.theory-example {
  background: #f3f9e9;
  border-left: 4px solid #b7ff00;
}

.theory-note {
  background: #f1f1ef;
  border-left: 4px solid #171717;
}


.theory-editable:focus {
  border-color: #9bd900;
  box-shadow: 0 0 0 3px rgba(183, 255, 0, .16);
}


.theory-dot {
  background: #d5d5d0;
}

.theory-dot.active {
  background: #171717;
  box-shadow: 0 0 0 4px rgba(183, 255, 0, .45);
}


.theory-arrow {
  color: #171717;
  background: #b7ff00;
  border-color: #b7ff00;
}

.theory-arrow:not(:disabled):hover {
  color: #171717;
  background: #a4e600;
  border-color: #a4e600;
  box-shadow: 0 4px 14px rgba(183, 255, 0, .3);
}

.theory-arrow:disabled {
  color: #999;
  background: #eeeeeb;
  border-color: #eeeeeb;
  opacity: .7;
}


.answer-option:hover:not(:disabled) {
  border-color: #b7ff00;
  background: #f8fceF;
}

.answer-option.correct {
  border-color: #80c69b;
  background: #edf8f0;
}

.exercise-item.active {
  background: #000;
}


.toast {
  color: #171717;
  background: #b7ff00;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .15);
}

/* =================================
   FORMA — DARK THEME
================================= */

body.dark-theme {
  --bg: #101110;
  --surface: #1b1d1b;
  --ink: #f4f4f0;
  --muted: #a0a49d;
  --line: #30332e;

  --accent: #b7ff00;
  --accent-dark: #171717;

  --soft: #252a1d;
  --danger: #ff7777;
  --success: #71d69b;

  --primary: #b7ff00;
  --border: #30332e;
  --text: #f4f4f0;

  --shadow: 0 12px 35px rgba(0, 0, 0, .25);

  color: var(--ink);
  background: var(--bg);
}

/* Основные поверхности */

body.dark-theme .sidebar,
body.dark-theme .topbar,
body.dark-theme .card,
body.dark-theme .stat-card,
body.dark-theme .admin-selectors {
  background: var(--surface);
  border-color: var(--line);
}

body.dark-theme .workspace,
body.dark-theme main {
  background: var(--bg);
}

/* Текст */

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme .brand,
body.dark-theme .lesson-row-info strong,
body.dark-theme .stat-card strong,
body.dark-theme .sidebar-bottom strong {
  color: var(--ink);
}

body.dark-theme .muted,
body.dark-theme .subtitle,
body.dark-theme .breadcrumb,
body.dark-theme .nav-item {
  color: var(--muted);
}

/* Навигация */

body.dark-theme .nav-item:hover {
  color: #fff;
  background: #292c27;
}

body.dark-theme .nav-item.active {
  color: #b7ff00;
  background: #282e1d;
  box-shadow: inset 3px 0 0 #b7ff00;
}

body.dark-theme .nav-item.active .nav-glyph {
  color: #b7ff00;
}

body.dark-theme .sidebar-bottom {
  border-color: var(--line);
}

/* Карточки и статистика */

body.dark-theme .stat-symbol,
body.dark-theme .lesson-index {
  color: #b7ff00;
  background: #2a321c;
}

body.dark-theme .stat-card:nth-child(2) .stat-symbol {
  color: #75d9d2;
  background: #1d3533;
}

body.dark-theme .stat-card:nth-child(3) .stat-symbol {
  color: #f5d36d;
  background: #38301d;
}

/* Главный баннер */

body.dark-theme .hero {
  background: #20231e;
  color: #fff;
  border: 1px solid #343a2b;
}

body.dark-theme .hero h1 {
  color: #fff;
}

body.dark-theme .hero p {
  color: #c3c8bd;
}

body.dark-theme .hero-side {
  background: #b7ff00;
  color: #171717;
}

/* Кнопки */

body.dark-theme .button:not(.primary):not(.lime) {
  color: var(--ink);
  background: #252825;
  border-color: #3a3e38;
}

body.dark-theme .button.primary,
body.dark-theme .button.lime {
  color: #171717;
  background: #b7ff00;
  border-color: #b7ff00;
}

/* Поля ввода */

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .theory-editable {
  color: var(--ink);
  background: #202320;
  border-color: #41463d;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #858b80;
}

/* Теория */

body.dark-theme .theory {
  color: var(--ink);
  background: #1b1e1b;
  border-color: var(--line);
}

body.dark-theme .theory-heading {
  color: #b7ff00;
}

body.dark-theme .theory-example {
  color: var(--ink);
  background: #202b20;
  border-color: #b7ff00;
}

body.dark-theme .theory-note {
  color: var(--ink);
  background: #292820;
  border-color: #f5d36d;
}

/* Упражнения */

body.dark-theme .answer-option {
  color: var(--ink);
  background: #202320;
  border-color: #393e37;
}

body.dark-theme .answer-option:hover:not(:disabled) {
  background: #2b321f;
  border-color: #b7ff00;
}

body.dark-theme .answer-option.correct {
  color: #8ee3ae;
  background: #1b3023;
  border-color: #39865a;
}

body.dark-theme .answer-option.incorrect {
  color: #ff9999;
  background: #351f1f;
  border-color: #8e4848;
}

/* Пагинация */

body.dark-theme .theory-dot {
  background: #555a50;
}

body.dark-theme .theory-dot.active {
  background: #b7ff00;
}

/* Разделители и пустые блоки */

body.dark-theme .divider,
body.dark-theme .lesson-row,
body.dark-theme .word-row {
  border-color: var(--line);
}

body.dark-theme .empty {
  color: var(--muted);
  background: #1b1e1b;
  border-color: #41463d;
}

body.dark-theme .empty strong {
  color: var(--ink);
}

/* Уведомления */

body.dark-theme .toast {
  color: #171717;
  background: #b7ff00;
}

/* Theme toggle */

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;

  border: 1px solid var(--line);
  border-radius: 11px;

  color: var(--ink);
  background: var(--surface);

  font-size: 21px;
  cursor: pointer;
  transition: .2s ease;
}

.theme-toggle:hover {
  color: #171717;
  background: #b7ff00;
  border-color: #b7ff00;
  transform: rotate(-8deg);
}

body.dark-theme .theme-toggle {
  color: #b7ff00;
  background: #252825;
  border-color: #41463d;
}

body.dark-theme .theme-toggle:hover {
  color: #171717;
  background: #b7ff00;
}

.table-editor-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: auto;
}

.table-editor-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 1fr);
  gap: 8px;
  min-width: max-content;
}

.table-editor-row input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.table-cell-editor {
  min-width: 140px;
  min-height: 38px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  overflow-wrap: anywhere;
}

.table-cell-editor:focus {
  border-color: var(--primary);
}

.table-cell-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.table-format-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.table-format-toolbar button {
  /* Используем те же стили, что и у обычной панели */
  font: inherit;
}

/* =================================
   FORMA — MOBILE ADAPTATION
================================= */

@media (max-width: 680px) {

  /* Боковая панель */
  .sidebar {
    padding: 12px;
    overflow: hidden;
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    padding: 10px;
    font-size: 13px;
  }

  /* Верхняя панель */
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .breadcrumb {
    display: none;
  }

  .topbar-right {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-right > * {
    max-width: 100%;
  }

  /* Основное содержимое */
  main {
    width: 100%;
    padding: 20px 14px 36px;
  }

  .card,
  .admin-selectors {
    min-width: 0;
    padding: 15px;
  }

  /* Формы */
  .select-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  input,
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
  }

  /* Заголовки */
  h1 {
    font-size: 27px;
  }

  /* Таблицы */
  .theory-table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .theory-table {
    min-width: 420px;
  }

  /* Кнопки */
  .form-actions {
    gap: 7px;
  }

  .form-actions .button {
    max-width: 100%;
  }
}

/* Поле ответа и кнопка проверки */
form[data-form="check-text"] {
  display: flex;
  align-items: center;
  gap: 10px;
}

form[data-form="check-text"] input {
  flex: 1;
  min-width: 0;
}

form[data-form="check-text"] button {
  flex-shrink: 0;
}

.exercise-instructions {
  padding: 16px 18px;
  margin: 16px 0 22px;
  border: 1px solid #b7ff00;
  border-radius: 12px;
  background: rgba(183, 255, 0, 0.06);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.fill-text-content {
  line-height: 2.2;
  font-size: 16px;
  overflow-wrap: break-word;
}

.inline-gap-wrap {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  margin: 2px 3px;
  max-width: 100%;
}

.inline-gap {
  width: 86px;
  max-width: 100%;
  box-sizing: border-box;
}

.inline-gap:focus {
  border-bottom-color: #B7FF00;
}

.inline-gap.correct {
  border-bottom-color: #35b86b;
}

.inline-gap.incorrect {
  border-bottom-color: #e05252;
}

.gap-correct-answer {
  display: block;
  max-width: 140px;
  font-size: 11px;
  color: #35b86b;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

body.dark-theme .inline-gap {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

body.dark-theme .inline-gap:focus {
  border-bottom-color: #B7FF00;
}

body.dark-theme .gap-correct-answer {
  color: #71d69b;
}

/* Логотип Nexuly */
.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

/* Светлая тема */
body:not(.dark-theme) .brand-logo {
  content: url("assets/logo-light.png");
}

/* Тёмная тема */
body.dark-theme .brand-logo {
  content: url("assets/logo-dark.png");
}

.brand {
  white-space: nowrap;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: contain;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
}

.brand span {
  display: inline;
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  font-size: 16px;
}

.translated-word {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: baseline;
}

.word-translate {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-bottom: 1px dashed currentColor;
}

.word-translation {
  display: block;
  color: #B7FF00;
  font-size: 0.75em;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
}

.word-translation[hidden] {
  display: none;
}

/* Nexuly: module management */
.module-create-card {
  margin-bottom: 22px;
}
.module-create-form {
  display: grid;
  gap: 14px;
  max-width: 760px;
}
.module-list {
  display: grid;
  gap: 16px;
}
.module-card {
  display: grid;
  gap: 14px;
}
.module-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.module-card-top h2 {
  margin: 0 0 8px;
}
.module-card-top .muted {
  margin: 0;
}
.module-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--surface-2, #f1f2ef);
  color: var(--muted, #68716b);
  font-size: 12px;
  font-weight: 600;
}
.module-status.published {
  background: rgba(55, 139, 94, .12);
  color: #26734a;
}
.module-edit-form {
  display: grid;
  gap: 12px;
  max-width: 760px;
}
@media (max-width: 640px) {
  .module-card-top {
    flex-direction: column;
  }
}
