: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;
  --danger-dark: #cb433c;
  --shadow: 0 20px 60px rgba(26, 74, 104, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  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,
textarea,
select,
label {
  font: inherit;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.container {
  width: min(1340px, calc(100% - 32px));
  margin: 0 auto;
}

body.app-home .container,
body.app-portal .container,
body.app-section .container,
body.lesson-page .container,
body.app-profile .container,
body.app-assistant .container,
body.app-blog .container,
body.app-blog-post .container {
  width: 100%;
  max-width: none;
  margin: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(248, 251, 253, 0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(23, 53, 74, 0.06);
}

body.app-home .site-header,
body.app-portal .site-header,
body.app-section .site-header,
body.lesson-page .site-header,
body.app-profile .site-header,
body.app-assistant .site-header,
body.app-blog .site-header,
body.app-blog-post .site-header,
body.app-home .site-footer,
body.app-portal .site-footer,
body.app-section .site-footer,
body.lesson-page .site-footer,
body.app-profile .site-footer,
body.app-assistant .site-footer,
body.app-blog .site-footer,
body.app-blog-post .site-footer {
  display: none;
}

.topbar,
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
}

.site-main {
  min-height: calc(100vh - 146px);
  padding: 22px 0 32px;
}

body.app-home .site-main,
body.app-portal .site-main,
body.app-section .site-main,
body.lesson-page .site-main,
body.app-profile .site-main,
body.app-assistant .site-main,
body.app-blog .site-main,
body.app-blog-post .site-main {
  min-height: 100vh;
  padding: 24px 0;
}

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

.page-shell > * {
  min-width: 0;
}

body.app-home .page-shell,
body.app-portal .page-shell,
body.app-section .page-shell,
body.lesson-page .page-shell,
body.app-profile .page-shell,
body.app-assistant .page-shell,
body.app-blog .page-shell,
body.app-blog-post .page-shell {
  padding: 24px;
}

.learning-shell {
  align-items: start;
}

.full-width {
  width: 100%;
}

.inline-actions,
.hero-actions,
.card-actions,
.admin-actions-inline,
.quiz-actions,
.completion-modal__actions,
.topnav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.sidebar,
.hero,
.module-menu-panel,
.dashboard-card,
.lesson-panel,
.theory-card,
.quiz-card,
.portal-card,
.section-card,
.overview-card,
.sidebar-card,
.content-card,
.auth-card,
.admin-card {
  border-radius: var(--radius);
}

.sidebar {
  position: sticky;
  top: 94px;
  height: calc(100vh - 118px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
}

body.app-home .sidebar,
body.app-portal .sidebar,
body.app-section .sidebar,
body.lesson-page .sidebar,
body.app-profile .sidebar,
body.app-assistant .sidebar {
  top: 24px;
  height: calc(100vh - 48px);
  overflow: visible;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--ink);
}

.brand-sidebar {
  align-items: flex-start;
  gap: 12px;
}

.brand-sidebar .brand-mark {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  margin-top: 4px;
}

.brand-sidebar .brand-mark__svg {
  width: 70px;
  height: 70px;
  transform: translateY(6px);
}

.brand-mark {
  width: 92px;
  height: 92px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 92px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.brand-mark__inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.brand-mark__svg {
  width: 86px;
  height: 86px;
}

.brand-mark__capsule-outline {
  fill: rgba(255, 255, 255, 0.18);
  stroke: rgba(29, 103, 134, 0.18);
  stroke-width: 2.2;
}

.brand-mark__capsule-top {
  fill: rgba(255, 255, 255, 0.72);
}

.brand-mark__capsule-glass {
  fill: rgba(255, 255, 255, 0.28);
}

.brand-mark__capsule-bottom {
  fill: url(#brandCapsuleRed);
}

.brand-mark__capsule-seam {
  fill: none;
  stroke: rgba(34, 70, 96, 0.18);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.brand-mark__capsule-highlight {
  fill: none;
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.brand-mark__grain {
  fill: rgba(255, 246, 214, 0.95);
  stroke: rgba(210, 196, 146, 0.42);
  stroke-width: 0.7;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.25));
}

.brand-mark__capsule-rotate {
  transform-origin: center;
  animation: brandCapsuleFlip 7.2s ease-in-out infinite;
}

body .brand-mark {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.brand strong {
  display: block;
  margin-bottom: 4px;
}

.blog-shell {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.blog-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.blog-sidebar__brand,
.blog-sidebar__card,
.blog-article,
.blog-featured {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.blog-sidebar__brand,
.blog-sidebar__card {
  padding: 22px;
}

.blog-sidebar__brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.blog-sidebar__brand .brand-mark {
  width: 84px;
  height: 98px;
  flex: 0 0 84px;
  align-self: flex-start;
  overflow: visible;
}

.blog-sidebar__brand .brand-mark__inner {
  align-items: flex-start;
  justify-content: flex-start;
}

.blog-sidebar__brand .brand-mark__svg {
  width: 80px;
  height: 92px;
  transform: translateY(6px);
}

.blog-sidebar__text {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.blog-sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blog-sidebar__item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: rgba(255, 255, 255, 0.78);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.blog-sidebar__item strong {
  color: var(--ink);
  font-size: 1rem;
}

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

.blog-sidebar__item:hover,
.blog-sidebar__item.active {
  transform: translateY(-1px);
  border-color: rgba(42, 136, 168, 0.26);
  box-shadow: 0 18px 34px rgba(29, 103, 134, 0.12);
}

.blog-tag-reset {
  margin-top: 14px;
}

.blog-hero h2 {
  max-width: 820px;
}

.blog-featured,
.blog-article {
  padding: 30px;
}

.blog-summary {
  margin: 14px 0;
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink);
}

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

.blog-card {
  min-height: 240px;
}

.blog-card__excerpt {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.tag-row a.tag {
  text-decoration: none;
}

.blog-article__body a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.blog-article__body a:hover {
  color: var(--accent);
}

.blog-article__header {
  margin-bottom: 24px;
}

.blog-article__body {
  font-size: 1.04rem;
  line-height: 1.72;
}

.tag-active {
  background: rgba(42, 136, 168, 0.14);
  border-color: rgba(42, 136, 168, 0.22);
}

@keyframes brandCapsuleFlip {
  0%, 16% {
    transform: rotate(0deg);
  }
  24%, 40% {
    transform: rotate(180deg);
  }
  50%, 66% {
    transform: rotate(180deg);
  }
  74%, 100% {
    transform: rotate(360deg);
  }
}

.brand-mark__granules--high {
  animation: brandGranulesHigh 7.2s ease-in-out infinite;
}

.brand-mark__granules--low {
  animation: brandGranulesLow 7.2s ease-in-out infinite;
}

@keyframes brandGranulesHigh {
  0%, 12% {
    transform: translateY(0);
    opacity: 1;
  }
  20%, 44% {
    transform: translateY(34px);
    opacity: 1;
  }
  50%, 62% {
    transform: translateY(34px);
    opacity: 1;
  }
  70%, 94% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes brandGranulesLow {
  0%, 12% {
    transform: translateY(0);
    opacity: 0.24;
  }
  20%, 44% {
    transform: translateY(0);
    opacity: 0.12;
  }
  50%, 62% {
    transform: translateY(-34px);
    opacity: 1;
  }
  70%, 94% {
    transform: translateY(-34px);
    opacity: 0.2;
  }
  100% {
    transform: translateY(0);
    opacity: 0.24;
  }
}

.brand small,
.topnav,
.progress-text,
.hero-text,
.dashboard-card p,
.portal-card p,
.section-card p,
.overview-card p,
.lesson-content p,
.lesson-content li,
.lesson-caption,
.quiz-result,
.option-label,
.helper-text,
.status-box,
.notes-helper,
.notes-hint,
.progress-meta,
.portal-progress-brand span,
.portal-progress-percent,
.alert,
label,
input,
textarea,
select {
  color: var(--muted);
}

.brand h1,
.hero h2,
.dashboard-card h3,
.panel-header h3,
.theory-card h3,
.quiz-card h3,
.portal-card h3,
.section-card h2,
.overview-card h2,
.auth-card h1,
.auth-card h2 {
  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;
}

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

.hero,
.module-menu-panel,
.lesson-panel,
.theory-card,
.quiz-card,
.portal-card,
.section-card,
.overview-card,
.sidebar-card,
.content-card,
.dashboard-card,
.auth-card,
.admin-card {
  padding: 26px 28px;
}

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

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

body.app-home .hero h2,
body.app-portal .hero h2,
body.app-section .hero h2,
body.lesson-page .hero h2,
body.app-profile .hero h2,
body.app-assistant .hero h2 {
  max-width: 920px;
  font-size: clamp(2.4rem, 4.8vw, 4.2rem);
}

body.app-home .hero h2 {
  max-width: 760px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

body.app-home .hero-text {
  max-width: 980px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-badge,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badge {
  align-items: center;
  justify-content: flex-end;
}

body.app-home .hero-badge {
  max-width: 360px;
  align-content: flex-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);
  white-space: nowrap;
}

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

.portal-progress-card,
.portal-progress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-progress-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 53, 74, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-progress-item:hover,
.portal-progress-item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(42, 136, 168, 0.24);
  box-shadow: 0 14px 30px rgba(42, 136, 168, 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,
.portal-card-top,
.section-card-top,
.page-title,
.panel-header,
.manager-header,
.manager-item,
.module-button-head,
.portal-progress-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

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

.portal-progress-logo-wrap,
.portal-logo-wrap {
  position: relative;
  flex: 0 0 auto;
}

.portal-progress-logo-wrap {
  width: 30px;
  height: 30px;
}

.portal-logo-wrap {
  width: 40px;
  height: 40px;
}

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

.portal-progress-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  padding: 4px;
}

.portal-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  padding: 6px;
}

.portal-progress-logo-fallback,
.portal-logo-fallback,
.section-icon {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 0.96));
  color: var(--accent);
  font-family: "Unbounded", sans-serif;
}

.portal-progress-logo-fallback {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  font-size: 0.72rem;
}

.portal-logo-fallback,
.section-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  font-size: 0.82rem;
}

.section-icon {
  display: flex;
}

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

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

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

.portal-progress-bar span,
.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;
  width: auto;
  height: auto;
  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));
}

.certificate-identity-card {
  padding: 16px 18px;
  border: 1px solid rgba(23, 53, 74, 0.1);
  border-radius: 18px;
  background: rgba(250, 253, 255, 0.86);
  margin-bottom: 16px;
}

.certificate-identity-form {
  display: grid;
  grid-template-columns: 180px minmax(260px, 1fr) 160px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.certificate-identity-form label {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
}

.certificate-identity-form input[type="text"] {
  width: 100%;
}

.certificate-identity-msg {
  margin: 10px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.certificate-identity-msg--error {
  color: #b13344;
}

.certificate-identity-msg--success {
  color: #1f7b57;
}

.certificate-fullname-error {
  border-color: #d9534f !important;
  box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.18) !important;
}

.certificate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}

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

.certificate-preview-card {
  border: 1px solid rgba(42, 136, 168, 0.18);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(239, 248, 255, 0.94), rgba(255, 255, 255, 0.94));
  box-shadow: 0 18px 36px rgba(26, 74, 104, 0.1);
  padding: 18px;
}

.certificate-preview-sheet {
  height: 100%;
  min-height: 460px;
  border-radius: 18px;
  background: linear-gradient(155deg, #fefefe, #f4fbff);
  border: 1px solid rgba(23, 53, 74, 0.08);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.certificate-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.certificate-preview-logo {
  width: 44px;
  height: 62px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.certificate-pill-mark {
  width: 100%;
  height: 100%;
  display: block;
}

.certificate-preview-header strong {
  display: block;
  font-family: "Unbounded", sans-serif;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.2;
}

.certificate-preview-header span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.certificate-preview-title {
  margin-top: 12px;
  font-family: "Unbounded", sans-serif;
  font-size: 1.62rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.certificate-preview-sheet p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.certificate-preview-line {
  margin-top: 8px;
  height: 1px;
  background: rgba(23, 53, 74, 0.12);
}

.certificate-preview-name {
  margin-top: 14px;
  font-weight: 800;
  color: var(--ink);
  font-size: 1.06rem;
}

.certificate-preview-specialty {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.certificate-preview-sheet small {
  margin-top: auto;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar-action {
  text-align: center;
  justify-content: center;
}

.learning-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.learning-topbar__nav,
.learning-topbar__actions,
.learning-topbar__login {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.learning-topbar__link,
.learning-topbar__portal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  white-space: nowrap;
  min-width: 0;
}

.learning-topbar__portal > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-topbar__link.active,
.learning-topbar__portal.active {
  border-color: rgba(42, 136, 168, 0.28);
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 0.98));
}

.learning-topbar__portal-logo-wrap {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(23, 53, 74, 0.08);
  overflow: hidden;
  flex: 0 0 24px;
}

.learning-topbar__portal-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.learning-topbar__portal-fallback {
  font-family: "Unbounded", sans-serif;
  font-size: 0.56rem;
  color: var(--accent);
}

.learning-topbar__login input {
  width: 170px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
}

.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,
.portal-grid,
.section-grid,
.admin-grid,
.dashboard {
  display: grid;
  gap: 18px;
}

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

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

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

.portal-sections-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

body.app-portal .portal-sections-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-button,
.module-button,
.lesson-card,
.lesson-link {
  display: block;
  width: 100%;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.portal-button {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--accent-dark);
  font-weight: 600;
}

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

.status-card {
  min-width: 260px;
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

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

.lesson-step-meta {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.portal-button:hover,
.portal-button:focus-visible,
.module-button:hover,
.module-button:focus-visible,
.lesson-card:hover,
.lesson-card:focus-visible,
.lesson-link:hover,
.lesson-link:focus-visible {
  transform: translateY(-2px);
}

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

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

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

.portal-button-meta {
  margin-top: 8px;
  font-size: 0.96rem;
  white-space: nowrap;
}

body.app-home .portal-button {
  align-items: flex-start;
}

body.app-home .portal-button strong {
  margin-bottom: 2px;
  font-size: 0.98rem;
}

body.app-home .portal-button span {
  font-size: 0.9rem;
  line-height: 1.38;
}

body.app-home .portal-button-meta {
  margin-top: 6px;
}

body.app-home .module-menu-panel,
body.app-home .dashboard-card {
  padding: 24px;
}

.portal-button > div:last-child {
  min-width: 0;
}

.status-box,
.portal-progress-brand span,
.portal-progress-percent,
.portal-medal {
  white-space: nowrap;
}

.module-button {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  padding: 16px;
  border-radius: 20px;
  text-align: left;
}

.module-button:hover,
.module-button:focus-visible {
  border-color: rgba(42, 136, 168, 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-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: 360px;
  width: auto;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.78);
}

.dashboard-card {
  padding: 24px;
}

.section-portal-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.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);
  margin-bottom: 18px;
}

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

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

.lesson-card,
.lesson-link {
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  text-align: left;
}

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

.lesson-card.completed,
.lesson-link.completed {
  background: linear-gradient(180deg, rgba(225, 247, 235, 0.98), rgba(241, 252, 246, 1));
  border-color: rgba(58, 168, 111, 0.44);
  box-shadow: 0 16px 34px rgba(58, 168, 111, 0.14);
}

.lesson-card.active,
.lesson-link.active {
  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,
.lesson-link.active.completed {
  background: linear-gradient(180deg, rgba(209, 238, 247, 0.96), rgba(235, 250, 240, 1));
  border-color: rgba(58, 168, 111, 0.38);
  box-shadow: 0 18px 36px rgba(42, 136, 168, 0.12);
}

.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,
.lesson-link strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.lesson-card.completed strong,
.lesson-card.completed span,
.lesson-link.completed strong,
.lesson-link.completed span,
.lesson-card.active.completed strong,
.lesson-card.active.completed span,
.lesson-link.active.completed strong,
.lesson-link.active.completed span {
  color: var(--ink);
}

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

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

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

.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);
  line-height: 1.6;
}

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

.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;
}

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

.lesson-content ul {
  margin: 0;
  padding-left: 20px;
}

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

.lesson-image,
.lesson-media {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(23, 53, 74, 0.1);
}

.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);
  font-weight: 700;
}

.lesson-source p {
  margin: 0;
}

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

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

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

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

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

.question-card h4 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.45;
}

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

.option-label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px;
  border: 1px solid rgba(23, 53, 74, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.option-label:hover,
.option-label:focus-within {
  border-color: rgba(42, 136, 168, 0.28);
  box-shadow: 0 14px 28px rgba(42, 136, 168, 0.08);
  transform: translateY(-1px);
}

.option-label span {
  flex: 1 1 auto;
  color: var(--ink);
  line-height: 1.5;
}

.option-label input[type="radio"] {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
  margin-top: 2px;
  accent-color: var(--accent-dark);
}

.danger-action-button,
.primary-button,
.ghost-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.danger-action-button,
.primary-button,
.ghost-button,
.button {
  padding: 12px 18px;
  border-radius: 999px;
}

.button {
  border: 1px solid transparent;
  font-weight: 600;
}

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

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

.button-dark {
  background: var(--ink);
  color: #fff;
}

.danger-action-button {
  width: 100%;
  border: none;
  background: linear-gradient(180deg, #e45a52, var(--danger-dark));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(203, 67, 60, 0.22);
}

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

.danger-action-button:hover,
.danger-action-button:focus-visible {
  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;
}

.section-open-button {
  margin-top: 16px;
}

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

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

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

.completion-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.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: 0 auto;
  max-height: calc(100vh - 24px);
  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);
}

html.admin-modal-open,
body.admin-modal-open {
  overflow: hidden;
}

body.admin-modal-open {
  position: fixed;
  inset: 0;
  width: 100%;
}

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

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

.auth-section {
  min-height: calc(100vh - 148px);
  display: grid;
  place-items: center;
  padding: 36px 16px;
}

.auth-card {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(23, 53, 74, 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
}

.admin-page .container {
  width: min(1280px, calc(100% - 32px));
}

.section-space {
  padding: 24px 0;
}

.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.admin-nav a {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
}

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

.admin-card {
  background: rgba(255, 255, 255, 0.82);
}

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

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

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

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

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.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);
}

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

.manager-block,
.admin-summary,
.admin-manager-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manager-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 53, 74, 0.09);
}

.admin-table-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
}

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

.admin-subtitle-input {
  min-height: 72px;
  max-height: 72px;
  resize: none;
}

.admin-checkbox {
  align-self: end;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 50px;
}

.admin-checkbox input {
  width: auto;
}

.admin-editor-modal {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admin-editor-modal--wide {
  width: min(1180px, calc(100vw - 24px));
}

.admin-editor-modal .admin-form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

.admin-editor-form {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(280px, 0.85fr);
  grid-template-rows: auto auto auto auto auto;
  gap: 16px 24px;
  align-items: start;
}

.admin-editor-form > .admin-form-grid {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: 1fr;
}

.admin-editor-form > label:nth-of-type(1) {
  grid-column: 2;
  grid-row: 2;
}

.admin-editor-form > label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 3;
}

.admin-editor-form > .admin-checkbox {
  grid-column: 2;
  grid-row: 4;
  align-self: start;
}

.admin-editor-form > .editor-field {
  grid-column: 1;
  grid-row: 1 / span 4;
  align-self: stretch;
  min-height: calc(100vh - 220px);
}

.admin-editor-form > .summary-item {
  grid-column: 2;
  grid-row: 5;
}

.admin-editor-form > .completion-modal__actions {
  grid-column: 1 / -1;
  grid-row: 6;
  justify-content: flex-start;
}

.admin-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.admin-editor-layout__main,
.admin-editor-layout__side {
  min-width: 0;
}

.admin-editor-layout__main {
  display: flex;
  flex-direction: column;
}

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

.editor-field--fill {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 260px);
}

.editor-field--fill .rich-editor {
  flex: 1 1 auto;
}

.editor-field {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  gap: 8px;
  min-height: 0;
}

.editor-label {
  font-weight: 700;
  color: var(--ink);
}

.rich-editor {
  border: 1px solid rgba(23, 53, 74, 0.14);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.rich-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(23, 53, 74, 0.08);
  background: rgba(244, 248, 251, 0.8);
}

.rich-editor__toolbar button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(23, 53, 74, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  cursor: pointer;
}

.rich-editor__surface {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  outline: none;
  line-height: 1.6;
}

.rich-editor__surface figure,
.lesson-richtext figure {
  margin: 18px 0;
}

.rich-editor__surface img,
.lesson-richtext img {
  display: block;
  max-width: min(100%, 860px);
  height: auto;
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(23, 53, 74, 0.08);
}

.rich-editor__surface figcaption,
.lesson-richtext figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.rich-editor__surface h3,
.lesson-richtext h3 {
  margin: 18px 0 10px;
}

.rich-editor__surface blockquote,
.lesson-richtext blockquote {
  margin: 14px 0;
  padding-left: 16px;
  border-left: 3px solid rgba(42, 136, 168, 0.3);
  color: var(--muted);
}

.rich-editor__surface ul,
.rich-editor__surface ol,
.lesson-richtext ul,
.lesson-richtext ol {
  padding-left: 22px;
}

.rich-editor__surface p,
.lesson-richtext p {
  margin: 0 0 12px;
}

.blog-article__body .blog-lead {
  font-size: 1.12rem;
  line-height: 1.75;
  color: var(--ink);
}

.blog-article__body .blog-note,
.blog-article__body .blog-takeaway {
  margin: 20px 0;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(42, 136, 168, 0.16);
  background: linear-gradient(180deg, rgba(233, 246, 251, 0.9), rgba(248, 252, 255, 0.95));
}

.blog-article__body .blog-takeaway {
  border-color: rgba(228, 89, 79, 0.16);
  background: linear-gradient(180deg, rgba(255, 241, 239, 0.92), rgba(255, 249, 248, 0.96));
}

.blog-article__body .blog-note strong,
.blog-article__body .blog-takeaway strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.blog-article__body .blog-checklist,
.blog-article__body .blog-steps {
  list-style: none;
  padding-left: 0;
  margin: 18px 0;
  display: grid;
  gap: 12px;
}

.blog-article__body .blog-checklist li,
.blog-article__body .blog-steps li {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.blog-article__body .blog-checklist li::before {
  content: "✓";
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  border-radius: 999px;
  background: rgba(42, 136, 168, 0.12);
  color: var(--accent);
  font-weight: 800;
}

.blog-article__body hr {
  border: 0;
  border-top: 1px solid rgba(23, 53, 74, 0.08);
  margin: 28px 0;
}

@media (max-width: 980px) {
  .admin-editor-form {
    grid-template-columns: 1fr;
  }

  .admin-editor-form > .admin-form-grid,
  .admin-editor-form > label:nth-of-type(1),
  .admin-editor-form > label:nth-of-type(2),
  .admin-editor-form > .admin-checkbox,
  .admin-editor-form > .editor-field,
  .admin-editor-form > .summary-item,
  .admin-editor-form > .completion-modal__actions {
    grid-column: 1;
    grid-row: auto;
    min-height: 0;
  }

  .admin-editor-form > .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .certificate-layout {
    grid-template-columns: 1fr;
  }

  .portal-module-grid.certificate-grid {
    grid-template-columns: 1fr;
  }

  .certificate-preview-sheet {
    min-height: 320px;
  }

  .certificate-identity-form {
    grid-template-columns: 1fr;
  }
}

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

.site-footer {
  border-top: 1px solid rgba(23, 53, 74, 0.06);
  background: rgba(255, 255, 255, 0.66);
}

.legal-mini-footer {
  margin-top: 18px;
}

.legal-mini-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(23, 53, 74, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
}

.legal-mini-footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.legal-mini-footer__logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legal-mini-footer__logo .brand-mark__inner {
  width: 100%;
  height: 100%;
}

.legal-mini-footer__logo .brand-mark__svg {
  width: 34px;
  height: 34px;
}

.legal-mini-footer__brand strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
}

.legal-mini-footer__brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.legal-mini-footer__links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legal-mini-footer__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(42, 136, 168, 0.16);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.legal-doc-page .site-main {
  padding: 18px 0 24px;
}

.legal-doc-container {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
}

.legal-doc-card {
  padding: 22px 24px;
}

.legal-doc-card h1 {
  margin: 0 0 10px;
  font-family: "Unbounded", sans-serif;
  letter-spacing: -0.02em;
}

.legal-doc-card h2 {
  margin: 20px 0 8px;
}

.legal-doc-card p,
.legal-doc-card li {
  color: var(--muted);
  line-height: 1.55;
}

.legal-doc-card ul {
  margin: 0;
  padding-left: 20px;
}

.legal-doc-meta {
  margin: 0 0 14px;
  font-size: 0.88rem;
}

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

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

  .notes-card {
    position: static;
  }

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

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

  .learning-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .legal-mini-footer__row {
    flex-direction: column;
    align-items: flex-start;
  }

  .legal-mini-footer__links {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .portal-nav,
  .portal-grid,
  .section-grid,
  .portal-sections-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  .topbar,
  .footer-row,
  .panel-header,
  .portal-card-top,
  .section-card-top,
  .page-title,
  .manager-header,
  .manager-item {
    flex-direction: column;
  }

  .site-main {
    padding-top: 14px;
  }

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

  .page-shell {
    gap: 16px;
  }
}

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

body.app-home .content {
  gap: 24px;
}

body.app-home .sidebar {
  padding: 24px;
}

body.app-home .hero,
body.app-home .module-menu-panel,
body.app-home .dashboard-card {
  padding: 24px;
  border-radius: 24px;
}

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

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

body.app-home .hero-text {
  max-width: 980px;
  font-size: 0.95rem;
  line-height: 1.45;
}

body.app-home .hero-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 360px;
  justify-content: flex-end;
  align-content: flex-end;
}

body.app-home .hero-badge span {
  white-space: nowrap;
}

body.app-home .portal-nav {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

body.app-home .portal-button {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
}

body.app-home .portal-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

body.app-home .portal-button span {
  display: block;
  font-size: 0.9rem;
  line-height: 1.38;
}

body.app-home .portal-button-meta {
  margin-top: 8px;
  white-space: nowrap;
}

.portal-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  overflow: visible;
  padding: 6px 0 0;
}

.portal-module-grid.certificate-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.app-portal .portal-module-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px;
  overflow: visible;
}

.portal-module-grid .module-button {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.module-button-rich {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 253, 0.88));
  border: 1px solid rgba(42, 136, 168, 0.16);
  box-shadow: 0 14px 30px rgba(26, 74, 104, 0.08);
  position: relative;
  overflow: hidden;
}

.module-button-rich.completed {
  background: linear-gradient(180deg, rgba(47, 143, 116, 0.08), rgba(255, 255, 255, 0.98));
}

.module-button-rich::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #2f92b4, #37b7a8);
}

.module-button-rich:hover,
.module-button-rich:focus-within {
  transform: translateY(-3px);
  border-color: rgba(42, 136, 168, 0.3);
  box-shadow: 0 18px 36px rgba(26, 74, 104, 0.12);
}

.portal-module-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-module-index {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(42, 136, 168, 0.1);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.portal-module-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(42, 136, 168, 0.16);
  color: var(--accent-dark);
}

.portal-module-icon-svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-button-description {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.portal-module-tags {
  margin-top: auto;
}

.portal-module-actions {
  margin-top: 4px;
}

.portal-module-actions .primary-button,
.portal-module-actions .ghost-button {
  min-width: 174px;
}

.home-hero-premium {
  align-items: stretch;
}

.home-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.home-hero-lead {
  max-width: 720px;
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.58;
  color: var(--muted);
}

.home-hero-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  min-width: 320px;
}

.home-proof-card {
  width: min(100%, 360px);
  padding: 26px 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(42, 136, 168, 0.14), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(42, 136, 168, 0.18);
  box-shadow: 0 18px 38px rgba(42, 136, 168, 0.12);
}

.home-proof-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.home-proof-card strong {
  display: block;
  margin-bottom: 8px;
  font-family: "Unbounded", sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
  color: var(--ink);
}

.home-proof-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.home-hero-stats {
  max-width: 360px;
}

@media (max-width: 1180px) {
  body.app-portal .portal-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

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

  .home-hero-side {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
  }

  .home-proof-card,
  .home-hero-stats {
    width: 100%;
    max-width: none;
  }
}

body.lesson-page .lesson-card.completed,
body.app-section .lesson-card.completed,
body.lesson-page .lesson-link.completed {
  background: linear-gradient(180deg, #dff4e7 0%, #bce7cc 100%) !important;
  border-color: rgba(49, 149, 92, 0.5) !important;
  box-shadow: 0 14px 30px rgba(49, 149, 92, 0.16) !important;
}

body.lesson-page .lesson-card.active.completed,
body.app-section .lesson-card.active.completed,
body.lesson-page .lesson-link.active.completed {
  background: linear-gradient(180deg, #cfeefa 0%, #9dd8b4 100%) !important;
  border-color: rgba(42, 136, 168, 0.42) !important;
  box-shadow: 0 16px 34px rgba(42, 136, 168, 0.16) !important;
}

body.lesson-page .lesson-card.completed strong,
body.lesson-page .lesson-card.completed span,
body.app-section .lesson-card.completed strong,
body.app-section .lesson-card.completed span,
body.lesson-page .lesson-link.completed strong,
body.lesson-page .lesson-link.completed span,
body.lesson-page .lesson-card.active.completed strong,
body.lesson-page .lesson-card.active.completed span,
body.app-section .lesson-card.active.completed strong,
body.app-section .lesson-card.active.completed span,
body.lesson-page .lesson-link.active.completed strong,
body.lesson-page .lesson-link.active.completed span {
  color: #173d2d !important;
}

body.app-assistant .site-main {
  padding-top: 28px;
}

.assistant-sidebar-card {
  margin-top: 20px;
  margin-bottom: 18px;
  display: grid;
  gap: 12px;
  padding: 20px 18px;
}

.assistant-sidebar-card--collapsed {
  padding: 0;
  overflow: hidden;
}

.assistant-sidebar-card--collapsed[open] {
  overflow: visible;
}

.assistant-sidebar-card__summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
}

.assistant-sidebar-card__summary::-webkit-details-marker {
  display: none;
}

.assistant-sidebar-card__summary-copy {
  display: grid;
  gap: 4px;
}

.assistant-sidebar-card__summary-copy strong {
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.2;
}

.assistant-sidebar-card__summary-action {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(42, 136, 168, 0.1);
  color: #2a88a8;
  font-size: 0;
  font-weight: 700;
  align-self: start;
}

.assistant-sidebar-card__summary-action::before {
  content: "›";
  font-size: 1.1rem;
  line-height: 1;
}

.assistant-sidebar-card__body {
  padding: 0 16px 16px;
  display: grid;
  gap: 10px;
}

.assistant-sidebar-card--collapsed:not([open]) .assistant-sidebar-card__body {
  display: none;
}

.assistant-sidebar-card--collapsed[open] .assistant-sidebar-card__summary {
  border-bottom: 1px solid rgba(42, 136, 168, 0.1);
}

.assistant-sidebar-card__head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.assistant-sidebar-card__icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.assistant-mark {
  width: 28px;
  height: 28px;
}

.assistant-mark__bubble,
.assistant-mark__tail,
.assistant-mark__line {
  fill: none;
  stroke: url(#assistantMarkGradient);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-mark__orbit {
  fill: url(#assistantMarkGradient);
  transform-origin: center;
}

.assistant-mark__orbit--one {
  animation: assistantPulse 2.2s ease-in-out infinite;
}

.assistant-mark__orbit--two {
  animation: assistantPulse 2.2s ease-in-out infinite .4s;
}

.assistant-sidebar-card__text,
.assistant-sidebar-card__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.assistant-sidebar-card h3 {
  margin: 2px 0 0;
  font-size: 0.94rem;
  line-height: 1.2;
}

.assistant-mini-form {
  display: grid;
  gap: 8px;
}

.assistant-mini-form input,
.assistant-search-form__input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(42, 136, 168, 0.18);
  background: rgba(255, 255, 255, 0.94);
  font: inherit;
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.assistant-mini-form input:focus,
.assistant-search-form__input:focus {
  outline: none;
  border-color: rgba(42, 136, 168, 0.4);
  box-shadow: 0 0 0 4px rgba(42, 136, 168, 0.08);
}

.assistant-sidebar-card__link {
  font-weight: 700;
  color: #2a88a8;
  font-size: 0.9rem;
}

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

.assistant-hero__copy {
  max-width: 760px;
}

.assistant-hero__icon {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(46, 154, 192, 0.12), rgba(87, 192, 172, 0.16));
  box-shadow: inset 0 0 0 1px rgba(46, 154, 192, 0.16);
}

.assistant-hero__icon .assistant-mark {
  width: 62px;
  height: 62px;
}

.assistant-search-card,
.assistant-result-card,
.assistant-related-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(42, 136, 168, 0.12);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(20, 54, 80, 0.08);
}

.assistant-search-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.assistant-search-card__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.assistant-search-card__copy {
  display: grid;
  gap: 4px;
}

.assistant-search-card__copy h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.2;
}

.assistant-search-card__examples {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(42, 136, 168, 0.08);
}

.assistant-search-card__examples-head {
  margin-bottom: 12px;
}

.assistant-search-card__examples-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.2;
}

.assistant-search-form {
  display: grid;
  gap: 12px;
}

.assistant-search-form__label {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}

.assistant-search-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.assistant-search-form__submit {
  min-width: 180px;
}

.assistant-result-card__summary {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.assistant-route-card {
  margin-top: 18px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(46, 154, 192, 0.08), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(42, 136, 168, 0.18);
}

.assistant-route-card__badge,
.assistant-related-item__kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(42, 136, 168, 0.1);
  color: #2a88a8;
  font-size: .82rem;
  font-weight: 700;
}

.assistant-route-card h4,
.assistant-related-item h4 {
  margin: 14px 0 8px;
  color: var(--ink);
}

.assistant-route-card p,
.assistant-related-item p {
  margin: 0;
  color: var(--muted);
}

.assistant-route-card__actions,
.assistant-related-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.assistant-related-item {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 247, 250, 0.92));
}

.assistant-related-item.is-primary {
  border-color: rgba(42, 136, 168, 0.26);
  box-shadow: 0 14px 30px rgba(42, 136, 168, 0.08);
}

.assistant-related-item__summary {
  margin-top: 10px !important;
  line-height: 1.55;
}

.assistant-example-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.assistant-example-chip {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(42, 136, 168, 0.12);
  background: rgba(245, 250, 252, 0.9);
  color: rgba(23, 53, 74, 0.9);
  font-weight: 700;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}

.assistant-example-chip:hover,
.assistant-example-chip:focus-visible {
  border-color: rgba(42, 136, 168, 0.22);
  background: rgba(239, 248, 251, 0.98);
  color: var(--ink);
  transform: translateY(-1px);
}

@keyframes assistantPulse {
  0%, 100% {
    transform: scale(1);
    opacity: .88;
  }
  50% {
    transform: scale(1.14);
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .assistant-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .assistant-search-form__row,
  .assistant-related-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

.assistant-sidebar-card__summary-action::before {
  content: ">" !important;
}

.assistant-sidebar-card__body {
  padding: 10px 14px 14px !important;
  gap: 8px !important;
}

.assistant-mini-form .primary-button {
  margin-top: 2px;
  min-height: 42px;
  border-radius: 999px;
  font-size: 0.92rem;
  padding: 0 16px;
}

.module-button-link {
  text-decoration: none;
  color: inherit;
}

.module-button-link:hover,
.module-button-link:focus-visible {
  text-decoration: none;
  color: inherit;
}

.module-button-link .primary-button {
  pointer-events: none;
}

@media (max-width: 1024px) {
  .blog-shell {
    grid-template-columns: 1fr;
  }

  .blog-sidebar {
    position: static;
  }

  .blog-grid,
  .admin-editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-field--fill {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .blog-sidebar__brand {
    flex-direction: column;
  }

  .blog-featured,
  .blog-article,
  .blog-sidebar__brand,
  .blog-sidebar__card {
    padding: 22px 18px;
  }
}

/* Responsive hardening for all user pages + admin */
@media (max-width: 1180px) {
  body.app-home .page-shell,
  body.app-portal .page-shell,
  body.app-section .page-shell,
  body.lesson-page .page-shell,
  body.app-profile .page-shell,
  body.app-assistant .page-shell,
  body.app-blog .page-shell,
  body.app-blog-post .page-shell {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }

  body.app-home .sidebar,
  body.app-portal .sidebar,
  body.app-section .sidebar,
  body.lesson-page .sidebar,
  body.app-profile .sidebar,
  body.app-assistant .sidebar,
  body.app-blog .sidebar,
  body.app-blog-post .sidebar {
    position: static !important;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .study-layout,
  .quiz-screen,
  .dashboard,
  .portal-nav,
  .portal-sections-grid,
  body.app-portal .portal-sections-grid,
  .assistant-related-grid {
    grid-template-columns: 1fr;
  }

  body.app-portal .portal-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .learning-topbar {
    align-items: stretch;
    padding: 14px;
  }

  .learning-topbar__nav,
  .learning-topbar__actions {
    width: 100%;
  }

  .learning-topbar__nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
}

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

  .container {
    width: min(100%, calc(100% - 18px));
  }

  body.app-home .page-shell,
  body.app-portal .page-shell,
  body.app-section .page-shell,
  body.lesson-page .page-shell,
  body.app-profile .page-shell,
  body.app-assistant .page-shell,
  body.app-blog .page-shell,
  body.app-blog-post .page-shell {
    padding: 12px;
    gap: 14px;
  }

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

  .brand-sidebar .brand-mark {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
  }

  .brand-sidebar .brand-mark__svg {
    width: 56px;
    height: 56px;
    transform: translateY(4px);
  }

  h1,
  .hero h2,
  .blog-hero h2,
  .assistant-hero h2 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .hero h2,
  .blog-hero h2,
  .assistant-hero h2 {
    font-size: clamp(1.7rem, 7vw, 2.3rem);
    line-height: 1.06;
  }

  .hero-badge,
  .tag-row {
    flex-wrap: wrap;
  }

  .portal-progress-brand span,
  .portal-progress-percent,
  .portal-medal,
  .status-box {
    white-space: normal;
  }

  .portal-button,
  .module-button,
  .lesson-card,
  .lesson-link {
    min-height: 0;
  }

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

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

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

  .lesson-card span,
  .lesson-link span {
    overflow-wrap: anywhere;
  }

  .quiz-header-actions,
  .quiz-actions,
  .hero-actions,
  .admin-actions-inline {
    width: 100%;
  }

  .quiz-header-actions .ghost-button,
  .quiz-actions .primary-button,
  .quiz-actions .ghost-button,
  .hero-actions .primary-button,
  .hero-actions .ghost-button,
  .admin-actions-inline .button,
  .admin-actions-inline .ghost-button {
    width: 100%;
    justify-content: center;
  }

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

  .assistant-sidebar-card {
    margin-top: 8px;
  }

  .assistant-sidebar-card__summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 14px;
  }

  .assistant-sidebar-card__body {
    padding: 0 14px 14px !important;
  }

  .assistant-mini-form input,
  .assistant-search-form__input {
    min-height: 42px;
  }

  .assistant-search-form__row {
    grid-template-columns: 1fr;
  }

  .assistant-search-form__submit {
    width: 100%;
    min-width: 0;
  }

  .learning-topbar__nav {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .learning-topbar__link,
  .learning-topbar__portal {
    max-width: 100%;
  }

  .blog-shell {
    grid-template-columns: 1fr;
  }

  .blog-sidebar {
    position: static !important;
    top: auto !important;
  }

  .blog-sidebar__list {
    max-height: none;
  }

  .blog-sidebar__item span {
    font-size: 0.88rem;
    line-height: 1.35;
  }
}

@media (max-width: 620px) {
  .learning-topbar {
    padding: 12px;
    gap: 10px;
  }

  .learning-topbar__nav {
    gap: 8px;
  }

  .learning-topbar__link,
  .learning-topbar__portal {
    padding: 8px 12px;
    font-size: 0.92rem;
  }

  .learning-topbar__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .learning-topbar__actions .primary-button,
  .learning-topbar__actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .learning-topbar__login {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .learning-topbar__login input {
    width: 100%;
  }

  .home-proof-card {
    padding: 18px 16px;
    border-radius: 20px;
  }

  .home-proof-card strong {
    font-size: clamp(1.7rem, 12vw, 2.5rem);
  }

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

  .portal-button {
    padding: 12px;
    border-radius: 16px;
  }

  .portal-button strong {
    font-size: 0.94rem;
  }

  .portal-button span {
    font-size: 0.86rem;
  }

  .portal-button-meta {
    white-space: normal;
  }

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

@media (max-width: 980px) {
  .admin-page .container {
    width: min(100%, calc(100% - 16px));
  }

  .admin-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .admin-nav a {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table thead,
  .admin-table tbody,
  .admin-table tr {
    white-space: nowrap;
  }

  .admin-table th,
  .admin-table td {
    min-width: 130px;
  }

  .admin-table td:first-child,
  .admin-table th:first-child {
    min-width: 240px;
  }

  .admin-actions-inline {
    gap: 8px;
  }
}

@media (max-width: 760px) {
  .admin-editor-modal,
  .admin-editor-modal--wide {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 14px 12px;
  }

  .completion-modal__dialog.admin-editor-modal .panel-header {
    gap: 10px;
  }

  .admin-editor-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .editor-field--fill {
    min-height: 440px;
  }

  .rich-editor__surface {
    padding: 12px;
  }

  .rich-editor__toolbar {
    gap: 6px;
    padding: 10px;
  }

  .rich-editor__toolbar button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.9rem;
  }
}

/* Final mobile overrides (must be last to beat legacy/specific selectors) */
@media (max-width: 860px) {
  body.app-home .portal-nav,
  body.app-profile .portal-nav,
  body.app-portal .portal-nav,
  body.app-home .portal-module-grid,
  body.app-portal .portal-module-grid,
  body.app-home .portal-sections-grid,
  body.app-portal .portal-sections-grid {
    grid-template-columns: 1fr !important;
  }

  body.app-home .portal-button,
  body.app-profile .portal-button,
  body.app-portal .portal-button {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Home mobile order: hero first, top menu second, sidebar after content */
  body.app-home .page-shell.learning-shell {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px;
  }

  body.app-home .page-shell.learning-shell > .content {
    display: contents;
  }

  body.app-home .page-shell.learning-shell > .content > .hero {
    order: 1;
  }

  body.app-home .page-shell.learning-shell > .content > .learning-topbar {
    order: 2;
    overflow: visible;
  }

  body.app-home .page-shell.learning-shell > .sidebar {
    order: 3;
  }

  body.app-home .page-shell.learning-shell > .content > :not(.hero):not(.learning-topbar) {
    order: 4;
  }

  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;
  }
}

.home-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 24px;
  align-items: stretch;
}

.home-seo-card,
.home-latest-card {
  height: 100%;
}

.home-seo-copy {
  display: grid;
  gap: 14px;
  color: var(--muted);
  line-height: 1.72;
}

.home-seo-copy p {
  margin: 0;
}

.home-latest-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-latest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-latest-head h3 {
  margin: 0;
}

.home-latest-list {
  display: grid;
  gap: 14px;
  flex: 1;
}

.home-latest-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(42, 136, 168, 0.14);
  background: rgba(255, 255, 255, 0.76);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.home-latest-item:hover,
.home-latest-item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(42, 136, 168, 0.28);
  box-shadow: 0 14px 28px rgba(26, 74, 104, 0.1);
}

.home-latest-item strong {
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.35;
}

.home-latest-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.home-latest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-latest-link {
  margin-top: auto;
  color: var(--accent-dark);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .home-insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .home-latest-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-seo-copy {
    gap: 12px;
    line-height: 1.65;
  }

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

  body.app-portal .portal-module-grid .module-button,
  body.app-portal .portal-module-grid .module-button-rich {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}
