@font-face {
  font-family: "Open Sans";
  src: url("/assets/fonts/open-sans-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/assets/fonts/open-sans-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/assets/fonts/open-sans-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/assets/fonts/open-sans-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/assets/fonts/open-sans-800.woff2") format("woff2");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  --ink: #17201c;
  --muted: #66726c;
  --paper: #f5f6f2;
  --surface: #ffffff;
  --line: #dfe4de;
  --brand: #1e6048;
  --brand-dark: #164936;
  --brand-soft: #e5f1eb;
  --accent: #d68a3a;
  --danger: #a63f3f;
  --shadow: 0 12px 35px rgba(23, 32, 28, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Open Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.site-header {
  min-height: 68px;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  gap: 32px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--brand);
  font-family: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
}
.brand-mark.large { width: 48px; height: 48px; font-size: 1.4rem; margin-bottom: 18px; }
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav a {
  padding: 8px 11px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
}
.main-nav a:hover, .main-nav a.active { color: var(--brand); background: var(--brand-soft); }
.account { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 0.9rem; }
.account form { margin: 0; }

.page-shell, .editor-page, .narrow-page {
  width: min(1180px, calc(100% - 40px));
  margin: 42px auto 80px;
}
.narrow-page { width: min(720px, calc(100% - 40px)); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.heading-actions, .table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.page-heading h1, .narrow-page h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.05em; line-height: 1; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.lead { font-size: 1.08rem; color: var(--muted); }
.muted { color: var(--muted); }

.button {
  min-height: 40px;
  padding: 8px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
}
.button.primary { color: #fff; background: var(--brand); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { color: var(--brand); background: var(--brand-soft); border-color: #c8ddd2; }
.button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button.danger { color: #fff; background: var(--danger); }
.button.small { min-height: 34px; padding: 6px 11px; font-size: 0.86rem; }

.search {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search-main { display: flex; gap: 10px; }
.search-main > input { flex: 1; border: 0; background: transparent; }
.search-main select { width: auto; min-width: 210px; }
.search-main > input:focus { outline: none; }
.tag-filter { min-width: 0; padding: 10px; border: 0; border-top: 1px solid var(--line); }
.tag-filter legend { padding: 0 6px; font-weight: 750; }
.tag-filter legend .muted { font-weight: 400; }
.tag-options, .tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-option { display: inline-flex; width: auto; cursor: pointer; }
.tag-option input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.tag-option span, .tag-chip {
  padding: 5px 10px;
  color: #174a68;
  background: #e3f2fb;
  border: 1px solid #b8dced;
  border-radius: 999px;
  font-family: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}
.tag-option input:checked + span {
  color: #fff;
  background: #2e7ca5;
  border-color: #2e7ca5;
}
.tag-option input:focus-visible + span { outline: 3px solid rgba(46, 124, 165, 0.25); }
.tag-option small { opacity: 0.75; }
.tag-list { margin-top: 10px; }
.filter-result { margin: -10px 0 20px; }
.filter-result strong { color: var(--ink); }
.article-list { display: grid; gap: 12px; }
.article-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.article-card > div { flex: 1; min-width: 0; }
.article-card:hover { border-color: #b9cbc1; box-shadow: var(--shadow); }
.article-card h2 { margin: 8px 0 0; font-size: 1.18rem; }
.article-card h2 a { color: var(--ink); text-decoration: none; }
.excerpt { margin: 8px 0 0; color: var(--muted); max-width: 75ch; }
.excerpt mark {
  padding: 0 0.16em;
  color: #513b0f;
  background: #ffe59a;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.78rem; }
.badge { padding: 3px 8px; border-radius: 999px; font-weight: 750; }
.badge.published { color: #1e6048; background: #dff1e7; }
.badge.draft { color: #78511f; background: #faecd7; }
.area-chip {
  padding: 3px 8px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  font-weight: 700;
}
.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
}
.bulk-actions .muted { font-size: 0.82rem; }
.article-select { display: inline-flex; width: auto; }
.article-select input, .checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}
.empty-state, .upload-card, .form-card {
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stack { display: grid; gap: 18px; }
label { display: grid; gap: 7px; font-weight: 700; color: #334139; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd7d1;
  border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(30, 96, 72, 0.16);
  border-color: var(--brand);
}
.editor-fields { display: flex; align-items: end; gap: 14px; margin-bottom: 18px; }
.editor-fields .grow { flex: 1; }
.editor-fields label:not(.grow) { width: 220px; }
.classification-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.editor-form {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.editor-label { margin-bottom: 7px; }
.editor-insert-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.editor-insert-tools fieldset, .area-access {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.editor-insert-tools legend, .area-access legend { padding: 0 6px; font-weight: 750; }
.inline-tool { display: flex; gap: 8px; }
.inline-tool select { min-width: 0; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.form-error, .flash {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
}
.form-error { margin-bottom: 18px; color: #7e2929; background: #fbe7e7; border-color: #efc2c2; }
.flash { width: min(920px, calc(100% - 40px)); margin: 18px auto 0; }
.flash.success { color: #1e6048; background: #e2f3e9; border-color: #bcdcc9; }
.flash.warning { color: #78511f; background: #fff0d8; border-color: #ecd0a7; }

.reader-shell {
  width: min(1840px, calc(100% - 64px));
  margin: 42px auto 90px;
  display: grid;
  grid-template-columns: minmax(0, 1560px);
  gap: 52px;
  justify-content: center;
  align-items: start;
}
.reader-shell.with-toc { grid-template-columns: 230px minmax(0, 1560px); }
.toc {
  position: sticky;
  top: 100px;
  padding: 18px;
  border-left: 2px solid var(--line);
}
.toc-title { margin: 0 0 10px; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.toc nav { display: grid; gap: 7px; }
.toc a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.toc a:hover { color: var(--brand); }
.toc .level-3, .toc .level-4, .toc .level-5, .toc .level-6 { padding-left: 12px; }
.article-content {
  min-width: 0;
  padding: clamp(24px, 5vw, 58px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.article-header { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: 18px 0 20px; font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.05em; }
.prose {
  min-width: 0;
  font-family: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.08rem;
  line-height: 1.75;
}
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: "Open Sans", ui-sans-serif, system-ui, sans-serif; line-height: 1.2; letter-spacing: -0.025em; scroll-margin-top: 95px; }
.prose h1 { margin-top: 2.2em; font-size: 2rem; }
.prose h2 { margin-top: 2.1em; font-size: 1.65rem; }
.prose h3 { margin-top: 1.8em; font-size: 1.3rem; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose pre { overflow-x: auto; padding: 18px; color: #e9f2ed; background: #1b2922; border-radius: 10px; }
.prose code { padding: 0.15em 0.35em; background: #edf0ec; border-radius: 4px; font-size: 0.88em; }
.prose pre code { padding: 0; background: transparent; }
.prose blockquote { margin-left: 0; padding-left: 20px; color: var(--muted); border-left: 3px solid var(--accent); }
.prose table, table { width: 100%; border-collapse: collapse; }
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.prose table:has(> colgroup) {
  display: table;
  table-layout: fixed;
}
.prose th, .prose td, th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.prose th, .prose td {
  min-width: 0;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.prose td.number-cell,
.prose table:has(tbody > tr > td.number-cell:first-child) thead > tr > th:first-child {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}
.editor-help {
  margin: 10px 0 22px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.editor-help summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.editor-help p { margin-bottom: 8px; }
.editor-help pre {
  overflow-x: auto;
  margin: 8px 0 0;
  padding: 12px;
  color: #e9f2ed;
  background: #1b2922;
  border-radius: 8px;
}
.danger-zone { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--line); }

.auth-shell { min-height: calc(100vh - 58px); display: grid; place-items: center; padding: 30px 20px; }
.auth-card {
  width: min(440px, 100%);
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0; font-size: 2.4rem; letter-spacing: -0.05em; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-actions form { margin: 0; }
.usage-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}
.usage-summary div {
  padding: 14px;
  background: var(--paper);
  border-radius: 9px;
}
.usage-summary dt { color: var(--muted); font-size: 0.82rem; }
.usage-summary dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 800; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.checkbox-row span { display: grid; }
.compact-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 22px;
}
.compact-filter label { min-width: 240px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.media-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.media-card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #eef0ec;
  border-radius: 8px;
}
.media-file-preview {
  width: 100%;
  height: 180px;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--brand);
  background: #eef0ec;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
}
.media-file-preview strong { font-size: 1.6rem; letter-spacing: 0.05em; }
.media-file-preview span { color: var(--muted); font-size: 0.82rem; }
.media-card p { margin: 4px 0; }
.media-card code { display: block; overflow-wrap: anywhere; font-size: 0.76rem; }
.revision-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.revision-list, .revision-compare {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.revision-list h2 { margin-top: 0; }
.revision-list a {
  display: grid;
  gap: 3px;
  padding: 11px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
}
.revision-list a:hover, .revision-list a.active { background: var(--brand-soft); }
.revision-list a span { color: var(--muted); font-size: 0.8rem; }
.revision-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.revision-heading h2 { margin: 0; }
.revision-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.revision-columns pre {
  max-height: 65vh;
  overflow: auto;
  padding: 14px;
  background: #f2f4f0;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.site-footer { padding: 18px 4vw; color: var(--muted); text-align: center; font-size: 0.78rem; }
.error-page { text-align: center; padding-top: 70px; }
.error-code { margin: 0; color: var(--accent); font-size: 5rem; font-weight: 850; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.EasyMDEContainer .CodeMirror { border-color: #cfd7d1; border-radius: 8px; }
.editor-toolbar { border-color: #cfd7d1; border-radius: 8px 8px 0 0; }
.editor-toolbar .fa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-style: normal;
  line-height: 1;
}
.editor-toolbar .fa-bold::before { content: "B"; font-weight: 800; }
.editor-toolbar .fa-italic::before { content: "I"; font-family: Georgia, serif; font-style: italic; }
.editor-toolbar .fa-header::before { content: "H"; font-weight: 800; }
.editor-toolbar .fa-quote-left::before { content: "❞"; font-family: Georgia, serif; font-size: 20px; }
.editor-toolbar .fa-list-ul::before { content: "•≡"; font-weight: 700; letter-spacing: -2px; }
.editor-toolbar .fa-list-ol::before { content: "1."; font-size: 13px; font-weight: 700; }
.editor-toolbar .fa-link::before { content: "↗"; font-size: 18px; font-weight: 700; }
.editor-toolbar .fa-image::before { content: "▧"; font-size: 19px; }
.editor-toolbar .fa-table::before { content: "▦"; font-size: 19px; }
.editor-toolbar .fa-code::before { content: "</>"; font-family: Consolas, monospace; font-size: 11px; font-weight: 700; }
.editor-toolbar .fa-eye::before { content: "◉"; font-size: 18px; }
.editor-toolbar .fa-columns::before { content: "▥"; font-size: 19px; }
.editor-toolbar .fa-arrows-alt::before { content: "⛶"; font-size: 19px; }
.editor-toolbar .fa-question-circle::before { content: "?"; font-weight: 800; }

@media (max-width: 850px) {
  .site-header { padding: 10px 18px; flex-wrap: wrap; gap: 10px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .account span { display: none; }
  .reader-shell, .reader-shell.with-toc { grid-template-columns: 1fr; }
  .toc { position: static; border-left: 0; border-bottom: 1px solid var(--line); }
  .editor-fields { display: grid; }
  .editor-fields label:not(.grow) { width: 100%; }
  .editor-insert-tools, .classification-fields, .revision-columns { grid-template-columns: 1fr; }
  .revision-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .search-main { flex-wrap: wrap; }
  .search-main > input { flex-basis: 100%; }
  .article-card { align-items: flex-start; flex-direction: column; }
  .search-main, .compact-filter, .inline-tool { align-items: stretch; flex-direction: column; }
  .search-main select, .compact-filter label { width: 100%; min-width: 0; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .usage-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-content { padding: 24px 20px; }
  .auth-card { padding: 28px 22px; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
