﻿* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: linear-gradient(145deg, #102830, #0a1c22);
  color: #e6f3f7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 20px 18px 18px;
  min-height: 120px;
  background: rgba(7, 21, 26, 0.7);
  border-bottom: 1px solid rgba(106, 215, 255, 0.25);
  text-align: initial;
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-wrap {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  z-index: 2;
}

.title-wrap {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

.actions-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  z-index: 2;
}

.codex-logo {
  position: absolute;
  top: 12px;
  left: 16px;
  width: clamp(60px, 8vw, 120px);
  max-width: 20vw;
  width: clamp(60px, 8vw, 120px);
  max-width: 20vw;
  width: 200px;
  width: clamp(90px, 10vw, 170px);
  max-width: 170px;
  height: auto;
  display: block;
}

.page-header h1 {
  font-size: 34px;
  margin-bottom: 8px;
}

.page-header p {
  color: #b5d5df;
  font-size: 16px;
}

.add-lesson-btn {
  margin-top: 14px;
  background: #0e3d4b;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 700;
}

.manage-actions {
  margin-top: 14px;
  display: inline-flex;
  gap: 8px;
}

.page-main {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 40px;
  flex: 1 0 auto;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  justify-items: center;
}

.folder-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.folder-nav h2 {
  color: #6ad7ff;
  font-size: 24px;
  margin: 0;
}

#backToFolders {
  background: #0e3d4b;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.folder-card {
  position: relative;
  background: linear-gradient(180deg, rgba(18, 44, 52, 0.95), rgba(10, 25, 31, 0.98));
  border: 1px solid rgba(106, 215, 255, 0.35);
  border-radius: 16px;
  padding: 26px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  width: min(100%, 760px);
}

.folder-delete-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 120, 120, 0.7);
  background: rgba(110, 10, 10, 0.8);
  color: #ffe3e3;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.folder-delete-btn:hover {
  background: rgba(150, 15, 15, 0.9);
}

.folder-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(7, 26, 33, 0.55);
}

.folder-card h3 {
  margin: 0;
  color: #c8f2ff;
  font-size: 22px;
  text-align: center;
}

.folder-section {
  background: rgba(8, 21, 26, 0.85);
  border: 1px solid rgba(106, 215, 255, 0.2);
  border-radius: 16px;
  padding: 16px;
}

.folder-section h3 {
  color: #8ce8ff;
  margin-bottom: 12px;
  font-size: 20px;
}

.folder-lessons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  justify-items: center;
}

.lesson-card {
  position: relative;
  background: linear-gradient(180deg, rgba(22, 50, 58, 0.9), rgba(11, 27, 33, 0.95));
  border: 1px solid rgba(106, 215, 255, 0.35);
  border-radius: 16px;
  padding: 22px 22px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  width: min(100%, 900px);
  height: 332px;
  overflow: hidden;
}

.empty-state {
  width: 100%;
  text-align: center;
  padding: 24px;
  border-radius: 14px;
  border: 1px dashed rgba(106, 215, 255, 0.35);
  color: #cfe9f2;
  background: rgba(10, 25, 31, 0.55);
  font-weight: 700;
}

.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(7, 26, 33, 0.55);
}

.lesson-card h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: #6ad7ff;
  line-height: 1.35;
  padding-inline-end: 34px;
}

.lesson-card p {
  color: #d2e7ee;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  min-height: calc(1.6em * 4);
}

.card-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: #8ce8ff;
  border: 1px solid rgba(106, 215, 255, 0.4);
  border-radius: 999px;
  padding: 4px 10px;
}

.publish-state {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  line-height: 1;
}

.content-new-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e32222;
  box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(227, 34, 34, 0.7);
}

.publish-state.published {
  color: #2ed06e;
}

.publish-state.unpublished {
  color: #a7b7be;
}

.delete-lesson-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 133, 133, 0.5);
  background: rgba(72, 17, 17, 0.8);
  color: #ffd2d2;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.delete-lesson-btn:hover {
  background: rgba(105, 25, 25, 0.95);
}

.publish-controls {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.folder-controls {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.folder-select {
  width: 100%;
  border: 1px solid rgba(106, 215, 255, 0.35);
  border-radius: 8px;
  background: #07151a;
  color: #d6f3ff;
  padding: 8px 10px;
  font-family: inherit;
}

.folder-move-btn {
  justify-self: start;
  background: #184b60;
  border: 1px solid #6ad7ff;
  color: #e9faff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.publish-video-input {
  width: 100%;
  border: 1px solid rgba(106, 215, 255, 0.35);
  border-radius: 8px;
  background: #07151a;
  color: #d6f3ff;
  padding: 8px 10px;
  font-family: inherit;
}

.publish-lesson-btn {
  justify-self: start;
  background: #0f5d36;
  border: 1px solid #2ed06e;
  color: #e9fff2;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.edit-controls {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-btn {
  background: #123847;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

.edit-btn:hover {
  background: #0e3d4b;
}

body:not(.is-super) .add-lesson-btn,
body:not(.is-super) .publish-state,
body:not(.is-super) .delete-lesson-btn,
body:not(.is-super) .publish-controls,
body:not(.is-super) .folder-controls {
  display: none !important;
}

body:not(.is-super) .lesson-card {
  height: auto;
  min-height: 220px;
  padding-bottom: 22px;
}

body.is-super .lesson-card {
  height: auto;
  min-height: 360px;
  padding-bottom: 26px;
}

body.is-super .folder-controls,
body.is-super .publish-controls {
  margin-top: 14px;
}

body.is-super .edit-controls {
  margin-top: 14px;
  padding-top: 0;
  justify-content: flex-end;
}

body:not(.is-super) .page-header {
  padding: 18px 20px 14px !important;
}

body:not(.is-super) .page-header .header-inner {
  min-height: 76px !important;
}

body:not(.is-super) .page-header .logo-wrap {
  top: 10px !important;
  left: 0 !important;
  transform: none !important;
}

body:not(.is-super) .page-header .title-wrap {
  padding-inline: 120px 24px !important;
}

.page-header {
  min-height: 132px !important;
}

.page-header .header-inner {
  min-height: 90px !important;
}

.page-header .logo-wrap {
  top: 12px !important;
  left: 12px !important;
  transform: none !important;
}

.page-header .codex-logo {
  width: auto !important;
  max-width: 160px !important;
  max-height: 84px !important;
}

.page-header .title-wrap {
  padding-inline: 170px 170px !important;
}

.lesson-viewer {
  display: block;
  background: rgba(8, 20, 25, 0.85);
  border: 1px solid rgba(106, 215, 255, 0.3);
  border-radius: 16px;
  padding: 18px;
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.viewer-head h2 {
  color: #6ad7ff;
  font-size: 28px;
}

#backBtn {
  background: #0e3d4b;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.video-wrap {
    position: relative;
    width: min(100%, 1000px);
    padding-top: min(56.25%, 520px);
    margin: 0 auto 25px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(106, 215, 255, 0.3);
    background: #000;
}

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

.viewer-block {
  margin-top: 14px;
  background: rgba(13, 34, 41, 0.7);
  border: 1px solid rgba(106, 215, 255, 0.2);
  border-radius: 12px;
  padding: 14px;
}

.viewer-block h3 {
  margin-bottom: 10px;
  color: #a6deef;
}

.viewer-block p {
  line-height: 1.8;
}

.viewer-block pre {
  background: #07151a;
  border: 1px solid rgba(106, 215, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.viewer-block code {
  direction: ltr;
  text-align: left;
  display: block;
  color: #d6f3ff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.ide-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ide-actions button {
  background: #0e3d4b;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.ide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ide-pane h4 {
  margin-bottom: 8px;
  color: #9cd8eb;
  font-size: 15px;
}

#codeEditor {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(106, 215, 255, 0.35);
  background: #07151a;
  color: #d6f3ff;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  direction: ltr;
  text-align: left;
}

#codePreview {
  width: 100%;
  min-height: 320px;
  border-radius: 10px;
  border: 1px solid rgba(106, 215, 255, 0.35);
  background: #ffffff;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  width: min(640px, 100%);
  background: #0e242d;
  border: 1px solid rgba(106, 215, 255, 0.3);
  border-radius: 14px;
  padding: 16px;
}

.modal-card h3 {
  margin-bottom: 10px;
  color: #6ad7ff;
}

.modal-card form {
  display: grid;
  gap: 10px;
}

.modal-card label {
  color: #d4edf4;
  font-size: 14px;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid rgba(106, 215, 255, 0.35);
  border-radius: 8px;
  background: #07151a;
  color: #d6f3ff;
  padding: 10px;
  font-family: inherit;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.check-row input {
  width: auto;
}

.template-wrap {
  display: grid;
  gap: 8px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.modal-actions button {
  background: #0e3d4b;
  border: 1px solid #6ad7ff;
  color: #e6f3f7;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 700px) {
  .page-header h1 {
    font-size: 28px;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-wrap {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .title-wrap {
    position: static;
    pointer-events: auto;
  }

  .codex-logo {
    top: 10px;
    left: 12px;
    width: clamp(50px, 14vw, 100px);
    max-width: 30vw;
    width: clamp(50px, 14vw, 100px);
    max-width: 30vw;
    width: 200px;
    width: clamp(70px, 18vw, 130px);
    max-width: 130px;
  }

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

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

  .viewer-head h2 {
    font-size: 22px;
  }

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

.notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.note-card {
  background: rgba(10, 28, 35, 0.75);
  border: 1px solid rgba(106, 215, 255, 0.2);
  border-radius: 14px;
  padding: 14px;
  color: #d9f0f7;
  line-height: 1.6;
}

.note-card h4 {
  margin: 0 0 6px;
  color: #6ad7ff;
  font-size: 16px;
}

.note-card p {
  margin: 0;
  white-space: pre-line;
  line-height: 1.9;
}

@media (max-width: 720px) {
  .page-header {
    padding: 22px 16px;
  }

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

  .viewer-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .video-wrap iframe {
    height: 220px;
  }

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

@media (max-width: 1024px) {
  .page-main {
    width: min(1120px, calc(100% - 24px));
  }

  .lesson-card,
  .folder-card {
    padding: 18px;
  }

  .lesson-card {
    height: 320px;
  }
}

@media (max-width: 900px) {
  .manage-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

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

@media (max-width: 600px) {
  .page-header {
    padding: 20px 14px 16px;
  }

  .page-header p {
    font-size: 14px;
  }

  .lesson-card,
  .folder-card {
    width: 100%;
  }

  .lesson-card {
    height: auto;
    min-height: 280px;
  }

  .lesson-card h2 {
    font-size: 20px;
  }
}

.site-footer {
  margin-top: 40px;
  padding: 24px 16px 28px;
  background: rgba(7, 21, 26, 0.8);
  border-top: 1px solid rgba(106, 215, 255, 0.2);
}

.footer-inner {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  display: grid;
  gap: 12px;
  text-align: center;
}

.footer-title {
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #cdeaf3;
}

.footer-subtitle {
  color: #9bb9c2;
  font-size: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.footer-link {
  color: #9fd8ea;
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  color: #e6f3f7;
}

.footer-icon-link {
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid rgba(106, 215, 255, 0.22);
  border-radius: 14px;
  background: rgba(10, 30, 37, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.footer-icon-link:hover {
  transform: translateY(-2px);
  border-color: rgba(106, 215, 255, 0.55);
  background: rgba(13, 40, 49, 0.92);
}

.footer-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

.footer-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.footer-icon-badge-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.footer-icon-badge-phone {
  background: #ffffff;
}

.footer-icon-badge-phone .footer-icon {
  filter: brightness(0) saturate(100%);
}

.footer-copy {
  color: #9bb9c2;
  font-size: 13px;
}

@media (max-width: 600px) {
  .footer-links {
    gap: 10px;
  }

  .footer-icon-link {
    min-width: calc(50% - 10px);
    padding: 10px 12px;
  }
}

/* === Header Layout Fix (Codex) === */
.page-header {
  text-align: initial;
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
}

.logo-wrap {
  display: flex;
  align-items: center;
}

.actions-wrap {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.manage-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.title-wrap {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  direction: rtl;
  pointer-events: none;
}

.codex-logo {
  width: clamp(90px, 10vw, 150px);
  max-width: 150px;
  height: auto;
  display: block;
}

@media (max-width: 900px) {
  .page-header h1 { font-size: 28px; }
  .page-header p { font-size: 14px; }
}

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .title-wrap {
    position: static;
    width: 100%;
    order: 2;
    pointer-events: auto;
  }

  .actions-wrap {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .codex-logo {
    width: clamp(70px, 18vw, 120px);
    max-width: 120px;
  }
}

@media (max-width: 480px) {
  .page-header { padding: 18px 12px 14px; }
  .codex-logo { width: clamp(64px, 22vw, 110px); }
}

/* === Codex Header Override (force layout) === */
.page-header .header-inner {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  direction: ltr !important;
}

.page-header .logo-wrap {
  display: flex !important;
  align-items: center !important;
  margin-right: auto !important;
  margin-left: 0 !important;
  order: 1 !important;
}

.page-header .actions-wrap {
  display: flex !important;
  align-items: center !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  justify-content: flex-end !important;
  order: 3 !important;
}

.page-header .title-wrap {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  text-align: center !important;
  direction: rtl !important;
  pointer-events: none !important;
  order: 2 !important;
}

.page-header .codex-logo {
  width: clamp(90px, 10vw, 150px) !important;
  max-width: 150px !important;
  height: auto !important;
  margin-top: 5px !important;
}

@media (max-width: 700px) {
  .page-header .header-inner {
    flex-wrap: wrap !important;
  }

  .page-header .title-wrap {
    position: static !important;
    width: 100% !important;
    pointer-events: auto !important;
    order: 2 !important;
  }

  .page-header .actions-wrap {
    width: 100% !important;
    justify-content: flex-end !important;
    order: 3 !important;
  }

.page-header .codex-logo {
  width: clamp(70px, 18vw, 120px) !important;
  max-width: 120px !important;
  margin-top: 5px !important;
}
}

@media (max-width: 480px) {
.page-header .codex-logo {
  width: clamp(64px, 22vw, 110px) !important;
  margin-top: 5px !important;
}

.site-footer {
  margin-top: auto;
}
}

/* === Codex Logo Final Layout === */
.page-header {
  padding: 24px 20px 18px !important;
}

.page-header .header-inner {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  direction: ltr !important;
  min-height: 108px !important;
}

.page-header .logo-wrap {
  position: absolute !important;
  top: 50% !important;
  left: 0 !important;
  transform: translateY(-50%) !important;
  z-index: 3 !important;
  margin: 0 !important;
}

.page-header .codex-logo {
  display: block !important;
  width: clamp(96px, 11vw, 170px) !important;
  max-width: none !important;
  height: auto !important;
  margin: 0 !important;
}

.page-header .title-wrap {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  direction: rtl !important;
  pointer-events: none !important;
  padding-inline: 180px !important;
}

.page-header .actions-wrap {
  margin-left: auto !important;
  padding-top: 6px !important;
  z-index: 2 !important;
}

@media (max-width: 900px) {
  .page-header {
    min-height: 122px !important;
  }

  .page-header .logo-wrap {
    top: 10px !important;
    left: 10px !important;
  }

  .page-header .codex-logo {
    max-width: 132px !important;
    max-height: 72px !important;
  }

  .page-header .title-wrap {
    padding-inline: 140px 136px !important;
  }

  body:not(.is-super) .page-header .title-wrap {
    padding-inline: 104px 16px !important;
  }

  .page-header {
    padding: 22px 16px 18px !important;
  }

  .page-header .header-inner {
    min-height: 92px !important;
  }

  .page-header .codex-logo {
    width: clamp(84px, 14vw, 136px) !important;
  }

  .page-header .title-wrap {
    padding-inline: 140px !important;
  }
}

@media (max-width: 700px) {
  body:not(.is-super) .page-header {
    padding: 16px 14px 12px !important;
  }

  body:not(.is-super) .page-header .header-inner {
    min-height: auto !important;
  }

  .page-header .header-inner {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-areas:
      "logo actions"
      "title title" !important;
    align-items: start !important;
    min-height: auto !important;
  }

  .page-header .logo-wrap {
    position: static !important;
    grid-area: logo !important;
    align-self: center !important;
    transform: none !important;
  }

  .page-header .actions-wrap {
    grid-area: actions !important;
    width: auto !important;
    justify-content: flex-end !important;
    padding-top: 0 !important;
  }

  .page-header .title-wrap {
    position: static !important;
    grid-area: title !important;
    display: block !important;
    padding-inline: 0 !important;
    padding-top: 8px !important;
    pointer-events: auto !important;
  }

  .page-header .codex-logo {
    max-width: 112px !important;
    max-height: 60px !important;
  }
}

@media (max-width: 480px) {
  body:not(.is-super) .page-header .title-wrap {
    padding-inline: 0 !important;
  }

  .page-header {
    padding: 18px 12px 14px !important;
  }

  .page-header .header-inner {
    gap: 12px !important;
  }

  .page-header .codex-logo {
    max-width: 92px !important;
    max-height: 52px !important;
  }

  .page-header .manage-actions {
    gap: 6px !important;
  }

  .page-header .add-lesson-btn {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}

/* === Codex Final Header/Card Overrides === */
.page-header {
  min-height: 132px !important;
  padding: 18px 20px 14px !important;
}

.page-header .header-inner {
  position: relative !important;
  min-height: 96px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
}

.page-header .logo-wrap {
  position: absolute !important;
  top: 10px !important;
  left: 12px !important;
  display: flex !important;
  align-items: flex-start !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 3 !important;
}

.page-header .codex-logo {
  display: block !important;
  width: auto !important;
  max-width: 150px !important;
  max-height: 76px !important;
  height: auto !important;
  margin: 0 !important;
}

.page-header .title-wrap {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  padding-inline: 170px !important;
  pointer-events: none !important;
}

.page-header .actions-wrap {
  margin-left: auto !important;
  padding-top: 6px !important;
  z-index: 2 !important;
}

body:not(.is-super) .page-header {
  min-height: 118px !important;
  padding: 16px 20px 12px !important;
}

body:not(.is-super) .page-header .header-inner {
  min-height: 82px !important;
}

body:not(.is-super) .page-header .title-wrap {
  padding-inline: 132px 24px !important;
}

body.is-super .lesson-card {
  min-height: 0 !important;
  height: auto !important;
  padding-bottom: 24px !important;
}

body.is-super .folder-controls,
body.is-super .publish-controls,
body.is-super .edit-controls {
  margin-top: 14px !important;
}

body.is-super .edit-controls {
  justify-content: flex-end !important;
  padding-top: 0 !important;
}

@media (max-width: 900px) {
  .page-header {
    min-height: 120px !important;
    padding: 18px 16px 14px !important;
  }

  .page-header .header-inner {
    min-height: 88px !important;
  }

  .page-header .logo-wrap {
    top: 10px !important;
    left: 10px !important;
  }

  .page-header .codex-logo {
    max-width: 126px !important;
    max-height: 66px !important;
  }

  .page-header .title-wrap {
    padding-inline: 142px 130px !important;
  }

  body:not(.is-super) .page-header .title-wrap {
    padding-inline: 110px 16px !important;
  }
}

@media (max-width: 700px) {
  .page-header,
  body:not(.is-super) .page-header {
    min-height: auto !important;
    padding: 16px 14px 12px !important;
  }

  .page-header .header-inner,
  body:not(.is-super) .page-header .header-inner {
    min-height: auto !important;
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    grid-template-areas:
      "logo actions"
      "title title" !important;
    gap: 12px !important;
    align-items: center !important;
  }

  .page-header .logo-wrap {
    position: static !important;
    grid-area: logo !important;
    align-self: start !important;
  }

  .page-header .actions-wrap {
    grid-area: actions !important;
    width: auto !important;
    justify-content: flex-end !important;
    padding-top: 0 !important;
  }

  .page-header .title-wrap,
  body:not(.is-super) .page-header .title-wrap {
    position: static !important;
    grid-area: title !important;
    display: block !important;
    padding: 4px 0 0 !important;
    pointer-events: auto !important;
  }

  .page-header .codex-logo {
    max-width: 108px !important;
    max-height: 58px !important;
  }
}

@media (max-width: 480px) {
  .page-header,
  body:not(.is-super) .page-header {
    padding: 14px 12px 10px !important;
  }

  .page-header .codex-logo {
    max-width: 88px !important;
    max-height: 48px !important;
  }

  .page-header .manage-actions {
    gap: 6px !important;
  }
}
