:root {
  --bg: #f4f8fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #17354a;
  --muted: #5f7688;
  --line: rgba(23, 53, 74, 0.1);
  --accent: #2a88a8;
  --accent-dark: #1d6786;
  --accent-soft: rgba(42, 136, 168, 0.12);
  --success: #2f8f74;
  --danger: #d45a63;
  --shadow: 0 20px 60px rgba(26, 74, 104, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(42, 136, 168, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(212, 90, 99, 0.12), transparent 26%),
    linear-gradient(135deg, #f8fbfd 0%, #edf5f9 48%, #f7fbfd 100%);
  font-family: "Manrope", sans-serif;
}

button,
input,
label {
  font: inherit;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 24px;
}

.full-width {
  width: 100%;
}

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

.sidebar,
.hero,
.admin-panel,
.module-menu-panel,
.dashboard-card,
.lesson-panel,
.theory-card,
.quiz-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  padding: 24px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  gap: 1px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)) padding-box,
    linear-gradient(145deg, #2f92b4, #1d6786) border-box;
  border: 1px solid transparent;
  color: #f7fdff;
  font-family: "Unbounded", sans-serif;
  font-size: 0.95rem;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
}

.brand h1,
.hero h2,
.dashboard-card h3,
.panel-header h3,
.theory-card h3 {
  margin: 0;
}

.brand h1,
.hero h2 {
  font-family: "Unbounded", sans-serif;
  letter-spacing: -0.03em;
}

.eyebrow,
.card-label,
.quiz-hint,
.tag {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.eyebrow,
.card-label {
  margin: 0 0 8px;
}

.progress-card {
  background: linear-gradient(180deg, rgba(240, 249, 252, 0.98), rgba(231, 243, 249, 0.92));
  border-radius: 24px;
  padding: 20px;
  border: 1px solid rgba(42, 136, 168, 0.16);
}

.progress-text,
.hero-text,
.dashboard-card p,
.lesson-content p,
.quiz-result,
.option-label {
  color: var(--muted);
}

.portal-progress-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-progress-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 53, 74, 0.08);
}

.portal-progress-item.active {
  border-color: rgba(42, 136, 168, 0.28);
  background: rgba(255, 255, 255, 0.94);
}

.portal-progress-head,
.portal-progress-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-progress-brand {
  justify-content: flex-start;
}

.portal-progress-brand strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.portal-progress-brand span,
.portal-progress-percent {
  color: var(--muted);
  font-size: 0.88rem;
}

.portal-progress-logo-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.portal-progress-logo {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(23, 53, 74, 0.08);
  object-fit: contain;
  padding: 5px;
}

.portal-progress-logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 0.96));
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 0.72rem;
}

.portal-progress-logo-missing .portal-progress-logo {
  display: none;
}

.portal-progress-logo-missing .portal-progress-logo-fallback {
  display: flex;
}

.portal-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 53, 74, 0.08);
  overflow: hidden;
}

.portal-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f92b4, #37b7a8);
}

.portal-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
  font-size: 0;
  line-height: 0;
}

.portal-medal::before,
.portal-medal::after {
  content: none !important;
}

.portal-medal-svg {
  width: 21px;
  height: 21px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(194, 140, 36, 0.24));
}

.module-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.module-nav-top {
  flex-direction: row;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 2px;
  scrollbar-width: thin;
}

.portal-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.portal-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.portal-button:hover,
.portal-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(42, 136, 168, 0.28);
  box-shadow: 0 12px 28px rgba(42, 136, 168, 0.08);
}

.portal-button.active {
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.16), rgba(255, 255, 255, 0.96));
  border-color: rgba(42, 136, 168, 0.32);
}

.portal-button strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.portal-button span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.portal-logo-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.portal-logo {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(23, 53, 74, 0.08);
  object-fit: contain;
  padding: 6px;
}

.portal-logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 0.96));
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.portal-logo-missing .portal-logo {
  display: none;
}

.portal-logo-missing .portal-logo-fallback {
  display: flex;
}

.module-button {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  padding: 16px;
  border-radius: 20px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.module-button:hover,
.module-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(196, 106, 47, 0.35);
}

.module-button.active {
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.15), rgba(255, 255, 255, 0.92));
  border-color: rgba(42, 136, 168, 0.28);
}

.module-button strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1rem;
}

.module-button-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.module-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #39b26f, #239358);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(35, 147, 88, 0.2);
  flex: 0 0 28px;
}

.module-nav-top .module-button {
  min-width: 280px;
  max-width: 340px;
  width: auto;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.78);
}

.module-nav-top .module-button strong {
  font-size: 1.02rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero,
.admin-panel,
.module-menu-panel,
.lesson-panel,
.theory-card,
.quiz-card {
  border-radius: 28px;
  padding: 28px;
}

.module-menu-panel {
  padding-top: 22px;
  padding-bottom: 22px;
}

.compact-header {
  margin-bottom: 10px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.hero h2 {
  max-width: 760px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.hero-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.hero-badge span,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(42, 136, 168, 0.18);
}

.dashboard {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-auth {
  display: block;
}

.admin-card {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 250, 241, 0.8);
  border: 1px solid var(--line);
}

.narrow-card {
  max-width: 440px;
}

.wide-card {
  grid-column: 1 / -1;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  border: 1px solid rgba(63, 43, 29, 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.admin-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-manager-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.manager-section {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
}

.manager-header,
.manager-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.manager-header {
  margin-bottom: 16px;
}

.manager-header p,
.manager-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.manager-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.manager-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(63, 43, 29, 0.09);
}

.summary-item,
.empty-state {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.summary-item span {
  display: inline-block;
  margin-right: 10px;
}

.admin-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.helper-text {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.status-box {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted);
}

.status-box.success {
  color: var(--success);
}

.status-box.error {
  color: var(--danger);
}

.small-button {
  padding: 10px 14px;
}

.danger-button {
  border-color: rgba(178, 70, 51, 0.3);
  color: var(--danger);
}

.dashboard-card {
  border-radius: 24px;
  padding: 24px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.lesson-panel-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
}

.lesson-panel-summary strong {
  color: var(--ink);
}

.lesson-card {
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.lesson-card:hover,
.lesson-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(42, 136, 168, 0.28);
  box-shadow: 0 14px 30px rgba(42, 136, 168, 0.12);
}

.lesson-card.completed {
  background: linear-gradient(180deg, rgba(47, 143, 116, 0.09), rgba(255, 255, 255, 1));
}

.lesson-card.active {
  transform: translateY(-3px);
  border-color: rgba(42, 136, 168, 0.42);
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 1));
  box-shadow: 0 16px 34px rgba(42, 136, 168, 0.16);
}

.lesson-card.active.completed {
  border-color: rgba(42, 136, 168, 0.42);
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.16), rgba(47, 143, 116, 0.08) 55%, rgba(255, 255, 255, 1));
}

.lesson-card-quiz {
  border-color: rgba(203, 67, 60, 0.18);
  background: linear-gradient(180deg, rgba(229, 90, 82, 0.1), rgba(255, 255, 255, 0.98));
}

.lesson-card-quiz:hover,
.lesson-card-quiz:focus-visible,
.lesson-card-quiz.active {
  border-color: rgba(203, 67, 60, 0.34);
  box-shadow: 0 14px 30px rgba(203, 67, 60, 0.12);
}

.lesson-card strong {
  display: block;
  margin-bottom: 8px;
}

.lesson-complete-trigger {
  width: 100%;
  height: 1px;
}

.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.quiz-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.lesson-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  line-height: 1.7;
}

.lesson-content ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.lesson-figure {
  margin: 4px 0;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(63, 43, 29, 0.1);
}

.lesson-image {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(63, 43, 29, 0.1);
}

.lesson-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.lesson-source {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(233, 247, 246, 0.9);
  border: 1px solid rgba(33, 124, 124, 0.18);
}

.lesson-source-title {
  color: var(--ink);
}

.lesson-source p {
  margin: 0;
  color: var(--muted);
}

.lesson-source-link {
  color: var(--accent);
  font-weight: 600;
  word-break: break-word;
}

.completion-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.completion-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 28, 38, 0.42);
  backdrop-filter: blur(4px);
}

.completion-modal__dialog {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(42, 136, 168, 0.16);
  box-shadow: 0 28px 80px rgba(17, 28, 38, 0.22);
}

.completion-modal__dialog h3 {
  margin: 0 0 10px;
}

.completion-modal__dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.completion-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 22px;
}

.notes-card {
  position: sticky;
  top: 24px;
}

.notes-header {
  align-items: flex-start;
}

.notes-hint {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.notes-input {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  box-sizing: border-box;
}

.notes-input:focus {
  outline: 2px solid rgba(42, 136, 168, 0.2);
  border-color: rgba(42, 136, 168, 0.34);
}

.notes-helper {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.notes-lesson-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(23, 53, 74, 0.08);
}

.lesson-nav-button {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  white-space: normal;
  line-height: 1.45;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quiz-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.question-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.question-card h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.danger-action-button {
  margin-top: 16px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #e45a52, #cb433c);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(203, 67, 60, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.danger-action-button:hover,
.danger-action-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(203, 67, 60, 0.28);
}

.danger-action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-label {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(63, 43, 29, 0.1);
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.95);
}

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.primary-button {
  border: none;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #f7fdff;
}

.ghost-button {
  border: 1px solid rgba(42, 136, 168, 0.22);
  background: rgba(245, 251, 254, 0.92);
  color: var(--ink);
}

.primary-button:hover,
.ghost-button:hover,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-2px);
}

.quiz-result {
  margin-top: 18px;
  min-height: 58px;
  border-radius: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(63, 43, 29, 0.16);
}

.quiz-result.success {
  color: var(--success);
  border-color: rgba(29, 122, 82, 0.25);
  background: rgba(29, 122, 82, 0.08);
}

.quiz-result.fail {
  color: var(--danger);
  border-color: rgba(178, 70, 51, 0.25);
  background: rgba(178, 70, 51, 0.08);
}

@media (max-width: 1100px) {
  .page-shell,
  .study-layout,
  .dashboard,
  .admin-grid,
  .portal-nav {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .hero {
    flex-direction: column;
    align-items: start;
  }

  .hero-badge {
    justify-content: start;
  }

  .module-nav-top .module-button {
    min-width: 240px;
  }

  .manager-header,
  .manager-item {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 14px;
  }

  .sidebar,
  .hero,
  .admin-panel,
  .module-menu-panel,
  .lesson-panel,
  .theory-card,
  .quiz-card,
  .dashboard-card {
    padding: 20px;
    border-radius: 22px;
  }

  .panel-header,
  .quiz-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Keep compatibility with new server templates on mobile */
@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .sidebar {
    position: static !important;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .study-layout,
  .quiz-screen,
  .dashboard,
  .portal-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    overflow-x: hidden;
  }

  .page-shell {
    padding: 12px;
    gap: 12px;
  }

  .sidebar,
  .hero,
  .admin-panel,
  .module-menu-panel,
  .lesson-panel,
  .theory-card,
  .quiz-card,
  .dashboard-card {
    padding: 16px;
    border-radius: 20px;
  }

  .lesson-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .lesson-card {
    padding: 14px;
    border-radius: 18px;
  }

  .lesson-card strong {
    font-size: 0.96rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .notes-input {
    min-height: 240px;
  }
}

@media (max-width: 620px) {
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .completion-modal__dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 18px;
    padding: 16px;
  }
}

@media (max-width: 860px) {
  .portal-nav {
    grid-template-columns: 1fr !important;
  }

  .portal-button {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.app-portal .module-nav.module-nav-top.portal-module-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 12px !important;
  }

  body.app-portal .module-nav.module-nav-top.portal-module-grid .module-button {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    flex: initial !important;
  }
}
