:root {
  --admin-bg: #f7f8fb;
  --admin-card: #ffffff;
  --admin-text: #17231d;
  --admin-muted: #667085;
  --admin-accent: #2f6f58;
  --admin-border: rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: var(--font-body, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
}

.learnAdminPage,
.learnArticlePage {
  min-height: 100vh;
  padding: 116px 24px 56px;
}

.learnArticlePage {
  padding-top: 62px;
}

.learnArticlePage {
  background: #fff;
}

.learnAdminShell,
.learnArticle {
  width: min(100%, 1120px);
  margin: 0 auto;
}

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

.adminEyebrow,
.articleKicker {
  margin: 0 0 10px;
  color: var(--admin-accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.adminHeader h1,
.learnArticle h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.04;
}

.adminHeader p,
.articleStandfirst {
  max-width: 680px;
  color: var(--admin-muted);
  font-size: 17px;
  line-height: 1.7;
}

button,
.secondaryLink {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(47, 111, 88, 0.18);
  background: #2f6f58;
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.secondaryBtn,
.secondaryLink {
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--admin-accent);
}

.dangerBtn {
  border-color: rgba(145, 64, 64, 0.22);
  color: #914040;
}

.adminNotice,
.adminPanel {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.035);
}

.adminNotice {
  padding: 22px;
  color: var(--admin-muted);
}

.adminPanel {
  padding: 22px;
  margin-top: 18px;
}

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

.adminPanelActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.adminPanel h2 {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 620;
}

.articleList {
  display: grid;
  gap: 10px;
}

.articleRow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: #fff;
}

.articleRow.is-selected {
  border-color: rgba(47, 111, 88, 0.28);
  background: #f4faf7;
}

.articleRow h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 620;
}

.articleRow p,
.saveStatus,
.articleMetaLine,
.articleDisclaimer {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

.saveStatus.is-error {
  color: #914040;
}

.articleForm {
  display: grid;
  gap: 14px;
}

.articleForm label {
  display: grid;
  gap: 7px;
  color: #34443c;
  font-size: 13px;
  font-weight: 650;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 12px;
  background: #fff;
  color: var(--admin-text);
  font: inherit;
  font-weight: 400;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.checkboxLabel {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
}

.checkboxLabel input {
  width: auto;
}

.formActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.learnArticle {
  max-width: 760px;
  background: #fff;
}

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

.articleActionGroup {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-height: 42px;
  padding: 4px 5px 4px 13px;
  border: 1px solid rgba(47, 111, 88, 0.16);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.backLink,
.editArticleLink,
.shareIconButton {
  display: inline-flex;
  align-items: center;
  color: var(--admin-accent);
  text-decoration: none;
  font-weight: 650;
}

.backLink {
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(47, 111, 88, 0.16);
  border-radius: 999px;
  background: #f4faf7;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
  font-size: 13px;
}

.shareIconButton {
  justify-content: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f4faf7;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.shareIconButton svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.backLink::before {
  content: "<";
  font-size: 15px;
  line-height: 1;
}

.backLink:hover,
.backLink:focus-visible,
.shareIconButton:hover,
.shareIconButton:focus-visible {
  border-color: rgba(47, 111, 88, 0.28);
  background: #e9f4ef;
  outline: none;
}

.editArticleLink {
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(47, 111, 88, 0.18);
  border-radius: 999px;
  background: #f4faf7;
  font-size: 13px;
}

.articleEditOverlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(18, 31, 25, 0.42);
  backdrop-filter: blur(8px);
}

.articleEditOverlay[hidden] {
  display: none;
}

.articleEditModal {
  width: min(100%, 980px);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 30px;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(16, 24, 40, 0.24);
}

.articleEditHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
}

.articleEditHeader h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 610;
}

.articleEditHeader p:not(.adminEyebrow) {
  margin: 8px 0 0;
  color: var(--admin-muted);
  font-size: 14px;
  line-height: 1.6;
}

.modalCloseBtn {
  min-height: 36px;
  background: #fff;
  color: var(--admin-accent);
}

.articleModalOpen {
  overflow: hidden;
}

.slugInputGroup {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.slugInputGroup button,
.browseImageBtn {
  min-height: 44px;
  background: #f4faf7;
  color: var(--admin-accent);
}

.imageInputGroup {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.imageHelpText {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.browseImageBtn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0 15px;
  border: 1px solid rgba(47, 111, 88, 0.18);
  border-radius: 12px;
  font-weight: 650;
  cursor: pointer;
}

.visuallyHiddenInput {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.imagePreviewWrap {
  display: block;
  overflow: hidden;
  height: 180px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 18px;
  background: #eef3ef;
}

.imagePreviewWrap[hidden] {
  display: none;
}

.imagePreviewWrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fieldLabel {
  display: block;
  margin-bottom: 9px;
  color: #34443c;
  font-size: 13px;
  font-weight: 650;
}

.modalCategoryBlock,
.wysiwygField {
  display: grid;
  gap: 10px;
}

.categoryChipGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.categoryChip {
  display: inline-flex !important;
  gap: 0 !important;
}

.categoryChip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.categoryChip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(47, 111, 88, 0.16);
  border-radius: 999px;
  background: #fbfdfc;
  color: #49645a;
  font-size: 13px;
  font-weight: 620;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.categoryChip input:checked + span {
  border-color: rgba(47, 111, 88, 0.34);
  background: #eef7f2;
  color: var(--admin-accent);
}

.editorToolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 16px 16px 0 0;
  background: #f7faf8;
}

.editorToolbar button {
  min-height: 34px;
  padding: 0 11px;
  background: #fff;
  color: #34443c;
  font-size: 13px;
}

.articleBodyEditor {
  min-height: 270px;
  padding: 20px;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  background:
    linear-gradient(180deg, rgba(247, 250, 248, 0.72), #fff 72px),
    #fff;
  color: #25352d;
  font-size: 17px;
  line-height: 1.8;
  outline: none;
}

.articleBodyEditor:focus {
  box-shadow: inset 0 0 0 2px rgba(47, 111, 88, 0.12);
}

.articleBodyEditor h2,
.articleBodyEditor h3 {
  margin: 22px 0 10px;
  line-height: 1.25;
}

.articleBodyEditor p,
.articleBodyEditor ul,
.articleBodyEditor ol {
  margin: 0 0 16px;
}

.articleMetaLine {
  margin-top: 18px;
  font-weight: 650;
}

.articleHeroImage {
  display: block;
  width: 100%;
  height: clamp(250px, 34vw, 350px);
  margin: 0 0 34px;
  border-radius: 22px;
  object-fit: cover;
  background: #eef3ef;
}

.articleHeroImage.articleInsightImage {
  width: min(100%, 960px);
  height: auto;
  aspect-ratio: 16 / 9;
  margin-right: auto;
  margin-left: auto;
  object-fit: contain;
}

.articleStatusNote {
  display: inline-flex;
  margin: 0 0 18px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #eef6f2;
  color: var(--admin-accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.articleStandfirst {
  margin: 28px 0 34px;
  font-size: 20px;
}

.articleBody {
  color: #25352d;
  font-size: 18px;
  line-height: 1.85;
}

.articleBody h2,
.articleBody h3 {
  margin: 34px 0 12px;
  line-height: 1.25;
  font-weight: 620;
}

.articleBody p,
.articleBody ul,
.articleBody ol {
  margin: 0 0 20px;
}

.articleBody a {
  color: #1f6f52;
  font-weight: 650;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(31, 111, 82, 0.42);
  border-radius: 3px;
  transition: background 140ms ease, color 140ms ease, text-decoration-color 140ms ease;
}

.articleBody a:hover,
.articleBody a:focus-visible {
  color: #174f3c;
  background: rgba(47, 111, 88, 0.08);
  text-decoration-color: rgba(31, 111, 82, 0.88);
  outline: none;
}

.articleInternalLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 34px 0 0;
  padding-top: 22px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
}

.articleInternalLinks a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid rgba(47, 111, 88, 0.18);
  border-radius: 999px;
  background: #f7fbf8;
  color: var(--admin-accent);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.articleInternalLinks a:hover,
.articleInternalLinks a:focus-visible {
  border-color: rgba(47, 111, 88, 0.36);
  background: #eef6f2;
}

.relatedArticles {
  margin-top: 54px;
  padding-top: 34px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
}

.relatedArticles h2 {
  margin: 0 0 24px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
}

.relatedArticleRail {
  display: grid;
  gap: 14px;
  margin: 0 0 34px;
}

.relatedArticleRail:last-child {
  margin-bottom: 0;
}

.relatedArticleRail h3 {
  margin: 0;
  color: #25352d;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 650;
}

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

.relatedArticleCard {
  min-height: 0;
  padding: 22px;
}

.relatedArticleCard h3,
.relatedArticleCard h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.relatedArticleCard p {
  font-size: 14px;
  line-height: 1.65;
}

.articleDisclaimer {
  width: min(100%, 760px);
  margin: 42px auto 0;
}

@media (max-width: 760px) {
  .learnAdminPage,
  .learnArticlePage {
    padding: 86px 16px 40px;
  }

  .learnArticlePage {
    padding-top: 42px;
  }

  .adminHeader,
  .adminPanelHeader,
  .articleRow {
    display: grid;
    grid-template-columns: 1fr;
  }

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

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

  .articleHeroImage {
    border-radius: 18px;
  }

  .articleEditOverlay {
    align-items: stretch;
    padding: 12px;
  }

  .articleEditModal {
    max-height: calc(100vh - 24px);
    padding: 20px;
    border-radius: 18px;
  }

  .articleEditHeader {
    display: grid;
  }
}
