/* ===================================================================
   Why are you spying on me you goose =3
   =================================================================== */

/* stripe colours for codex page types (mirrors the feed's .stripe.*) */
.stripe.article  { background: var(--wood); }
.stripe.document { background: var(--poi); }
.stripe.media    { background: var(--ship); }

/* ---- hero search (same parchment frame as .filters) ---- */
.cdx-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 15px 18px;
  background: linear-gradient(180deg, #ffe6a6, #e6b85e);
  border-left: 5px solid var(--wood-light);
  border-right: 5px solid var(--wood-light);
  border-bottom: 5px solid var(--wood-light);
  box-shadow: 0 10px 0 rgba(57, 24, 8, 0.95);
}
.cdx-search input {
  flex: 1 1 auto;
  border: 1px solid var(--border);
  background: #fff3c8;
  color: var(--ink);
  border-radius: 3px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: Georgia, "Times New Roman", serif;
}
.cdx-search input:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.35);
}
.cdx-search button {
  flex: 0 0 auto;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  color: #2f1a0a;
  border: 2px solid #7a4815;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe7a7, #c98a32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 0 #5b2a0c;
  cursor: pointer;
}
.cdx-search button:hover { transform: translateY(-1px); }

/* ---- top-level section headings (the .section-title look, unboxed) ---- */
.cdx-heading {
  font-size: 20px;
  color: var(--gold-bright);
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
  border-bottom: 0;
  margin: 22px 0 12px;
  padding-bottom: 0;
}

.cdx-result-head {
  margin-bottom: 14px;
  color: var(--parchment-light);
  font-weight: 800;
}
.cdx-result-head a { color: var(--gold-bright); }

/* ---- category grid ---- */
.cdx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.cdx-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 14px;
  text-decoration: none;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cdx-tile:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.6), 6px 6px 0 rgba(73, 32, 10, 0.28);
}
.cdx-tile-name {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 205, 0.75);
}
.cdx-tile-count {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

/* ---- account panel (home) ---- */
.cdx-account {
  margin: 0 0 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-account-text { color: var(--ink); font-size: 15px; max-width: 60ch; }
.cdx-account-text strong { display: block; color: var(--wood-dark); font-size: 18px; margin-bottom: 2px; }
.cdx-account-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- buttons ---- */
.cdx-btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  padding: 9px 18px; border-radius: 6px; font-weight: 800; font-size: 14px;
  color: var(--gold-bright);
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  border: 2px solid var(--wood-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 138, 0.35), 2px 2px 0 rgba(73, 32, 10, 0.3);
  transition: transform 0.12s ease;
}
.cdx-btn:hover { transform: translateY(-1px); }
.cdx-btn.ghost {
  color: var(--wood-dark); background: #fff3c8; border-color: var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 205, 0.6), 2px 2px 0 rgba(73, 32, 10, 0.18);
}

/* ---- header "Sign up" pill ---- */
.status-pill.pill-accent {
  background: linear-gradient(180deg, #ffe08a, #d9a441);
  color: var(--wood-dark); border-color: var(--wood-dark); font-weight: 800;
}

/* ---- always-on admin bar (admins only) ---- */
.cdx-adminbar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  background: #2a1107; border-bottom: 2px solid var(--gold);
  padding: 5px 14px; font-size: 13px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.cdx-adminbar-badge { color: var(--gold-bright); font-weight: 800; margin-right: 10px; letter-spacing: 0.04em; white-space: nowrap; }
.cdx-adminbar a { color: var(--parchment-light); text-decoration: none; padding: 3px 9px; border-radius: 4px; white-space: nowrap; }
.cdx-adminbar a:hover { background: rgba(217, 164, 65, 0.22); color: var(--gold-bright); }
.cdx-adminbar a.active { background: var(--gold); color: var(--wood-dark); font-weight: 800; }
.cdx-adminbar-new { margin-left: auto; color: var(--gold-bright) !important; border: 1px solid var(--border-soft); }
.cdx-adminbar-new:hover { background: rgba(47, 143, 58, 0.25) !important; }

/* ---- welcome banner ---- */
.cdx-welcome {
  text-align: center; padding: 20px 18px 16px; margin-bottom: 14px;
  border: 2px solid var(--border); border-radius: 6px;
  background: linear-gradient(180deg, #fff1c4, #f0c976);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 220, 0.5), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-welcome h2 { font-family: Georgia, "Times New Roman", serif; font-size: 27px; color: var(--wood-dark); margin: 0 0 6px; }
.cdx-welcome p { color: var(--ink); margin: 0 auto 6px; max-width: 62ch; font-size: 15px; }
.cdx-welcome-stats { font-size: 13px; color: var(--ink-soft); }
.cdx-welcome-stats strong { color: var(--wood-dark); }

/* ---- two-column portal (Wikipedia-style, medieval panels) ---- */
.cdx-portal { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin: 16px 0 8px; align-items: start; }
.cdx-portal-col { display: flex; flex-direction: column; gap: 16px; }

.cdx-panel {
  border: 2px solid var(--border); border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-panel-head {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: var(--gold-bright); font-family: Georgia, "Times New Roman", serif;
  font-weight: 800; font-size: 17px; padding: 9px 14px;
  border-bottom: 2px solid var(--wood-dark); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.cdx-panel-body { padding: 14px 16px; color: var(--ink); font-size: 14.5px; line-height: 1.55; }
.cdx-panel-body p { margin: 0; }
.cdx-panel-body a { color: var(--wood-dark); font-weight: 700; text-decoration: none; }
.cdx-panel-body a:hover { text-decoration: underline; }
.cdx-panel-more { display: inline-block; margin-top: 4px; white-space: nowrap; }

/* featured article */
.cdx-feat-img {
  float: left; width: 150px; max-width: 42%; margin: 2px 14px 8px 0;
  border: 1px solid var(--border); border-radius: 4px;
}
.cdx-feat-title { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 800; color: var(--wood-dark); margin-bottom: 4px; }
.cdx-feat-text { color: var(--ink); }

/* wander / discover list */
.cdx-dyk-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cdx-dyk-list li { padding: 5px 0; border-bottom: 1px solid var(--border-soft); }
.cdx-dyk-list li:last-child { border-bottom: 0; }

/* latest changes list */
.cdx-news-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cdx-news-list li { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.cdx-news-list li:last-child { border-bottom: 0; }
.cdx-news-list a { flex: 1; }
.cdx-news-when { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }

/* category list */
.cdx-cat-list { list-style: none; margin: 0; padding: 0; }
.cdx-cat-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.cdx-cat-list li:last-child { border-bottom: 0; }
.cdx-cat-list span { color: var(--ink-soft); font-size: 12px; font-weight: 800; }

/* the account panel sits inside the left column now */
.cdx-portal .cdx-account { margin: 0; }

@media (max-width: 760px) {
  .cdx-portal { grid-template-columns: 1fr; }
}

/* ===================================================================
   Article reading + editing pages (view.php / edit.php / review.php),
   so the whole codex is cohesive once those are wrapped in the layout.
   =================================================================== */

.codex-page,
.codex-missing {
  max-width: none;
  margin: 0 auto;
  border-radius: 6px;
  background: linear-gradient(180deg, #fbf1d4, #f3e3bd);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 230, 0.55), 4px 4px 0 rgba(73, 32, 10, 0.22);
  padding: 30px 36px 26px;
}

/* the article's own title, inside the card (overrides the global gold h1) */
.codex-page .article-title {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--wood-dark);
  -webkit-text-fill-color: var(--wood-dark);
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.12;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  max-width: none;
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

/* Wikipedia-style lead meta line, just under the title */
.article-meta {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  margin: 0 0 20px;
}

/* --- the readable article body (overrides the feed's global p rule) --- */
.codex-body {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.75;
}
.codex-body > :first-child { margin-top: 0; }
.codex-body p,
.codex-body li,
.codex-body td,
.codex-body th {
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  font-size: inherit;
}
.codex-body p { margin: 0 0 1.05em; }
.codex-body h1, .codex-body h2, .codex-body h3, .codex-body h4 {
  color: var(--wood-dark);
  -webkit-text-fill-color: var(--wood-dark);
  text-shadow: none;
  font-family: Georgia, "Times New Roman", serif;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.25;
  margin: 1.5em 0 0.5em;
}
.codex-body h1 { font-size: 30px; border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.codex-body h2 { font-size: 24px; border-bottom: 1px solid var(--border-soft); padding-bottom: 4px; }
.codex-body h3 { font-size: 19px; }
.codex-body a { color: var(--wood); text-decoration: none; border-bottom: 1px solid rgba(90, 38, 14, 0.35); }
.codex-body a:hover { color: var(--wood-light); border-bottom-color: var(--gold); }
.codex-body a.redlink { color: var(--removed); border-bottom-color: rgba(168, 50, 50, 0.4); }
.codex-body ul, .codex-body ol { margin: 0 0 1.05em; padding-left: 1.6em; }
.codex-body li { margin: 0.3em 0; }
.codex-body blockquote {
  margin: 1.1em 0; padding: 0.5em 1.1em;
  border-left: 4px solid var(--gold);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink-soft); font-style: italic;
}
.codex-body code {
  background: rgba(90, 38, 14, 0.1);
  padding: 1px 5px; border-radius: 3px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.92em;
}
.codex-body pre {
  background: #2f1308; color: #f7e8c4;
  padding: 12px 14px; border-radius: 4px; overflow: auto; margin: 1.1em 0;
}
.codex-body pre code { background: none; color: inherit; padding: 0; }
.codex-body hr { border: 0; border-top: 2px solid var(--border-soft); margin: 1.6em 0; }
.codex-body img {
  max-width: 100%; height: auto; border: 1px solid var(--border);
  border-radius: 3px; box-shadow: 2px 2px 0 rgba(73, 32, 10, 0.18);
}
.codex-body table { border-collapse: collapse; margin: 1.1em 0; width: 100%; }
.codex-body th, .codex-body td { border: 1px solid var(--border-soft); padding: 7px 10px; }
.codex-body th { background: rgba(58, 36, 18, 0.14); color: var(--wood-dark); font-weight: 800; }

/* missing-page placeholder */
.codex-missing h1 {
  color: var(--ink); -webkit-text-fill-color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 4vw, 38px); margin: 0 0 12px;
  border-bottom: 2px solid var(--border); padding-bottom: 8px;
}
.codex-missing p { color: var(--ink); text-transform: none; letter-spacing: normal; font-size: 16px; }

/* categories bar (Wikipedia-style, at the foot of the article) */
.codex-cats-bar {
  margin-top: 24px; padding-top: 14px;
  border-top: 2px solid var(--border-soft);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.codex-cats-bar .label {
  font-weight: 900; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-soft);
}
.codex-cats-bar a {
  padding: 3px 11px; border-radius: 999px;
  background: rgba(217, 164, 65, 0.3); border: 1px solid var(--border-soft);
  color: var(--wood-dark); text-decoration: none; font-weight: 800; font-size: 13px;
}
.codex-cats-bar a:hover { background: rgba(217, 164, 65, 0.55); }

.codex-backlinks {
  margin-top: 22px;
  padding: 12px 16px;
  background: rgba(255, 250, 230, 0.55);
  border: 1px solid rgba(90, 38, 14, 0.25);
  border-radius: 4px;
}
.codex-backlinks h2 { margin: 0 0 8px; font-size: 15px; color: var(--wood-dark); text-transform: none; letter-spacing: normal; border: 0; }
.codex-backlinks ul { margin: 0; padding-left: 18px; }
.codex-backlinks li { text-transform: none; letter-spacing: normal; }
.codex-backlinks a { color: var(--wood); }

.codex-actions { margin-top: 18px; font-weight: 800; }
.codex-actions a { color: var(--wood-dark); }

/* link styled as a button (missing-page CTA, etc.) */
.cdx-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 11px 20px;
  text-decoration: none;
  font-weight: 800;
  color: #2f1a0a;
  border: 2px solid #7a4815;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe7a7, #c98a32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 0 #5b2a0c;
}
.cdx-btn:hover { transform: translateY(-1px); }

/* edit / suggest form */
.codex-edit {
  display: grid;
  gap: 14px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
  padding: 22px 24px;
}
.codex-edit label { display: grid; gap: 6px; font-weight: 800; color: var(--wood-dark); }
.codex-edit input,
.codex-edit textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff3c8;
  color: var(--ink);
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: Georgia, "Times New Roman", serif;
}
.codex-edit textarea { font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; line-height: 1.5; }
.codex-edit input:focus,
.codex-edit textarea:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.35);
}
.codex-edit button,
.review-actions button {
  justify-self: start;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  color: #2f1a0a;
  border: 2px solid #7a4815;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe7a7, #c98a32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 0 #5b2a0c;
  cursor: pointer;
}
.codex-note { color: var(--ink-soft); font-style: italic; }

/* review queue */
.codex-review h1 { color: var(--gold-bright); text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.codex-review .count {
  font-size: 14px; background: var(--removed); color: #fff;
  padding: 2px 10px; border-radius: 999px; vertical-align: middle;
}
.review-item {
  margin-bottom: 16px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
  padding: 16px 18px;
}
.review-item header { font-size: 15px; color: var(--ink); margin-bottom: 8px; }
.review-item .summary { font-style: italic; color: var(--ink-soft); margin: 0 0 10px; }
.review-item .diff { font-size: 12px; line-height: 1.5; }
.review-item .diff .dadd { color: var(--new); font-weight: 700; }
.review-item .diff .ddel { color: var(--removed); font-weight: 700; }
.review-item .diff .dctx { color: var(--ink-soft); }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.review-actions input {
  flex: 1 1 220px;
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 9px 10px; font-family: Georgia, serif;
}
.review-actions button.danger {
  background: linear-gradient(180deg, #f0a6a6, #b34a4a); color: #fff; border-color: #7a2a2a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 3px 0 #5a1f1f;
}

/* ---- browse page ---- */
.cdx-breadcrumb { margin-bottom: 14px; color: var(--parchment-light); font-weight: 800; }
.cdx-breadcrumb a { color: var(--gold-bright); text-decoration: none; }
.cdx-breadcrumb a:hover { text-decoration: underline; }
.cdx-breadcrumb .sep { opacity: 0.6; margin: 0 7px; }

.cdx-cat-block {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cdx-cat-name { font-size: 24px; font-weight: 900; color: var(--ink); text-shadow: 0 1px 0 rgba(255, 244, 205, 0.75); }
.cdx-cat-name a { color: inherit; text-decoration: none; }
.cdx-cat-name a:hover { color: var(--wood); }
.cdx-cat-total {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.cdx-cat-total:hover { color: var(--wood); }
.cdx-cat-block .cdx-grid { margin-bottom: 0; }

/* ---- auth pages (login / register / reset / account) ---- */
.cdx-auth {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
  padding: 22px 24px;
}
.cdx-auth label { display: grid; gap: 6px; font-weight: 800; color: var(--wood-dark); }
.cdx-auth input {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff3c8;
  color: var(--ink);
  border-radius: 3px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: Georgia, "Times New Roman", serif;
}
.cdx-auth input:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.35);
}
.cdx-auth button {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  color: #2f1a0a;
  border: 2px solid #7a4815;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe7a7, #c98a32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 0 #5b2a0c;
  cursor: pointer;
}
.cdx-auth button:hover { transform: translateY(-1px); }
.cdx-auth .alt { font-size: 14px; color: var(--ink-soft); }
.cdx-auth .alt a { color: var(--wood-dark); font-weight: 800; }

.cdx-msg {
  padding: 11px 13px;
  border-radius: 4px;
  font-weight: 800;
  border: 1px solid var(--border-soft);
  background: rgba(255, 243, 200, 0.6);
  color: var(--ink);
}
.cdx-msg.ok  { border-left: 4px solid var(--new);     color: var(--wood-dark); }
.cdx-msg.warn{ border-left: 4px solid var(--modified); color: var(--wood-dark); }
.cdx-msg.err { border-left: 4px solid var(--removed); color: #7a2222; }

/* ---- admin area ---- */
.cdx-admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #704018, #3f1d0b 52%, #291105);
  border: 2px solid var(--wood-light);
  box-shadow: inset 0 1px 0 rgba(255, 224, 138, 0.26);
}
.cdx-admin-nav a {
  padding: 8px 14px;
  border-radius: 4px;
  color: #ffe4a3;
  text-decoration: none;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cdx-admin-nav a:hover { background: rgba(255, 224, 138, 0.12); color: #fff4c8; }
.cdx-admin-nav a.active { background: rgba(255, 224, 138, 0.2); color: #fff4c8; }

.cdx-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-table th, .cdx-table td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid rgba(90, 38, 14, 0.2);
  vertical-align: middle;
}
.cdx-table th {
  background: rgba(58, 36, 18, 0.18);
  color: var(--wood-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cdx-table tr:last-child td { border-bottom: 0; }
.cdx-table .nowrap { white-space: nowrap; color: var(--ink-soft); font-size: 13px; }
.cdx-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.cdx-you { font-size: 12px; color: var(--mage); font-weight: 800; }

.cdx-inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.cdx-inline select {
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 5px 7px; font-family: Georgia, serif; font-weight: 700;
}
.cdx-row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cdx-row-actions a { color: var(--wood-dark); font-weight: 800; text-decoration: none; }
.cdx-row-actions a:hover { color: var(--wood); text-decoration: underline; }

.cdx-mini-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  color: #2f1a0a;
  border: 2px solid #7a4815;
  border-radius: 4px;
  background: linear-gradient(180deg, #ffe7a7, #c98a32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 2px 0 #5b2a0c;
  cursor: pointer;
}
.cdx-mini-btn:hover { transform: translateY(-1px); }
.cdx-mini-btn.danger {
  background: linear-gradient(180deg, #f0a6a6, #b34a4a);
  color: #fff; border-color: #7a2a2a; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 2px 0 #5a1f1f;
}

.badge-role, .badge-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(90, 38, 14, 0.3);
  background: rgba(255, 243, 200, 0.8);
  color: var(--ink);
}
.badge-status.s-active, .badge-status.s-published { color: #fff; background: var(--new); border-color: transparent; }
.badge-status.s-unverified, .badge-status.s-pending, .badge-status.s-draft { color: #3a2412; background: var(--modified); border-color: transparent; }
.badge-status.s-disabled, .badge-status.s-rejected { color: #fff; background: var(--removed); border-color: transparent; }

/* ---- category picker on the edit form ---- */
.cdx-cat-field { display: grid; gap: 8px; }
.cdx-cat-label { font-weight: 800; color: var(--wood-dark); }
.cdx-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 16px;
  padding: 14px;
  border-radius: 4px;
  background: rgba(255, 243, 200, 0.5);
  border: 1px solid var(--border-soft);
}
.cdx-cats .cat-group { display: grid; gap: 4px; align-content: start; }
.cdx-cats label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 700; cursor: pointer; }
.cdx-cats .cat-parent { font-weight: 900; color: var(--wood-dark); }
.cdx-cats .cat-child { padding-left: 18px; font-size: 14px; }
.cdx-cats input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--wood); }

/* ---- EasyMDE: tint the editor toward the parchment theme ---- */
.EasyMDEContainer .CodeMirror {
  background: #fff3c8;
  color: var(--ink);
  border-color: var(--border);
  border-radius: 0 0 3px 3px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}
.EasyMDEContainer .CodeMirror-cursor { border-color: var(--ink); }
.editor-toolbar {
  background: linear-gradient(180deg, #ffe6a6, #e6b85e);
  border-color: var(--border);
  border-radius: 3px 3px 0 0;
}
.editor-toolbar button { color: var(--wood-dark) !important; border-color: transparent !important; }
.editor-toolbar button:hover,
.editor-toolbar button.active { background: rgba(90, 38, 14, 0.16); border-color: var(--border-soft) !important; }
.editor-toolbar i.separator { border-color: var(--border-soft); }

/* Keep the formatting toolbar visible while editing long articles. */
.EasyMDEContainer .editor-toolbar:not(.fullscreen) {
  position: sticky;
  top: 0;
  z-index: 60;
}
/* When the sticky admin bar is on screen, sit just below it. */
body:has(.cdx-adminbar) .EasyMDEContainer .editor-toolbar:not(.fullscreen) {
  top: 33px;
}
.editor-preview, .editor-preview-side { background: #fff7df; color: var(--ink); }
.editor-preview a { color: var(--wood); }

/* ---- editor: additional infobox cards ---- */
#cdxBoxesList { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.cdx-box-card { border: 1px solid var(--border-soft); border-radius: 6px; padding: 10px; background: rgba(255, 246, 218, 0.55); }
.cdx-box-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cdx-box-place { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: #fff; }
.cdx-box-spacer { flex: 1; }
.cdx-box-head button { width: 28px; height: 28px; border: 1px solid var(--border-soft); border-radius: 4px; background: #fff; cursor: pointer; line-height: 1; }
.cdx-box-head .cdx-box-del { border-color: var(--removed); color: var(--removed); }
.cdx-box-head .cdx-box-del:hover { background: var(--removed); color: #fff; }
.cdx-box-add { margin-top: 6px; padding: 6px 14px; border: 1px dashed var(--border); border-radius: 5px; background: #fff3c8; color: var(--wood); cursor: pointer; font-weight: 600; }
.cdx-box-add:hover { background: rgba(217, 164, 65, 0.2); }
.cdx-box-marker-row { margin-top: 6px; }
.cdx-box-marker-row .cdx-box-key { margin-bottom: 4px; }
.cdx-box-marker { background: var(--wood-dark); color: var(--gold-bright); padding: 1px 6px; border-radius: 3px; font-size: 12px; }

/* ---- per-article documents (reader) + attachments (editor) ---- */
.codex-docs { margin: 28px 0 8px; }
.codex-docs h2 {
  font-size: 18px; color: var(--wood-dark); margin: 0 0 10px;
  border-bottom: 1px solid var(--border-soft); padding-bottom: 4px;
}
.codex-docs-list, .cdx-attach-list { list-style: none; margin: 0; padding: 0; }
.codex-docs-list li, .cdx-attach-list li {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-soft); border-radius: 6px;
  background: rgba(255, 243, 200, 0.6); margin-bottom: 6px; padding: 2px 6px;
}
.codex-docs-list a, .cdx-attach-list a {
  display: flex; align-items: center; gap: 10px; flex: 1;
  text-decoration: none; color: var(--wood); padding: 8px 6px;
}
.codex-docs-list a:hover { background: rgba(217, 164, 65, 0.14); border-radius: 4px; }
.cdx-doc-ico { font-size: 18px; }
.cdx-doc-name { font-weight: 600; flex: 1; word-break: break-word; }
.cdx-doc-size { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }

.cdx-attach { margin: 22px 0; padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: 8px; background: rgba(217, 164, 65, 0.10); }
.cdx-attach h2 { font-size: 17px; color: var(--wood-dark); margin: 0 0 4px; }
.cdx-attach .cdx-sub { margin: 0 0 12px; }
.cdx-attach-empty { color: var(--ink-soft); font-style: italic; margin: 0 0 12px; }
.cdx-attach-remove {
  border: 1px solid var(--removed); color: var(--removed); background: #fff;
  border-radius: 4px; width: 28px; height: 28px; cursor: pointer; font-size: 13px; line-height: 1;
}
.cdx-attach-remove:hover { background: var(--removed); color: #fff; }
.cdx-attach-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cdx-attach-add input[type=file] { font-size: 13px; }
.cdx-attach-name { padding: 6px 9px; border: 1px solid var(--border-soft); border-radius: 5px; font-size: 13px; min-width: 220px; flex: 1; }
.cdx-attach-add button { padding: 6px 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--wood); color: var(--gold-bright); cursor: pointer; font-weight: 600; }
.cdx-attach-add button:disabled { opacity: .6; cursor: default; }
.cdx-attach-status { font-size: 13px; color: var(--new); }
.cdx-attach-status.err { color: var(--removed); }

/* ---- bilingual: reader switcher + editor toggle ---- */
.codex-langbar { display: flex; gap: 6px; align-items: center; margin: 0 0 14px; flex-wrap: wrap; }
.codex-langbar a, .codex-langbar span {
  font-size: 13px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--border-soft); text-decoration: none; color: var(--wood);
}
.codex-langbar a:hover { background: rgba(217, 164, 65, 0.18); }
.codex-langbar a.active { background: var(--wood); color: var(--gold-bright); border-color: var(--border); font-weight: 700; }
.codex-langbar a.create { color: var(--new); border-style: dashed; }
.codex-langbar .muted { color: var(--ink-soft); border-style: dashed; }

.cdx-lang-edit {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px; padding: 8px 12px;
  background: rgba(217, 164, 65, 0.16); border: 1px solid var(--border-soft); border-radius: 6px;
}
.cdx-lang-label { font-weight: 800; color: var(--wood-dark); }
.cdx-lang-edit a {
  padding: 4px 14px; border: 1px solid var(--border); border-radius: 4px;
  text-decoration: none; color: var(--wood); background: #fff3c8; font-weight: 600;
}
.cdx-lang-edit a.active { background: var(--wood); color: var(--gold-bright); font-weight: 800; }

/* ---- editor: internal-link picker ---- */
.editor-toolbar .cdx-wikilink-btn::after { content: "\1F517"; font-size: 14px; line-height: 1; }
.cdx-link-modal {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: flex-start; justify-content: center; background: rgba(30, 15, 5, 0.5);
}
.cdx-link-box {
  margin-top: 12vh; width: min(440px, 92vw);
  background: #fbf1d4; border: 2px solid var(--border); border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); padding: 14px 16px;
}
.cdx-link-title { font-weight: 800; color: var(--wood-dark); margin-bottom: 8px; }
.cdx-link-input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--border);
  background: #fff3c8; color: var(--ink); border-radius: 4px; padding: 9px 11px;
  font-family: Georgia, serif; font-size: 15px;
}
.cdx-link-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 300px; overflow: auto; }
.cdx-link-results li {
  padding: 8px 10px; border-radius: 4px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.cdx-link-results li:hover { background: rgba(217, 164, 65, 0.22); }
.cdx-link-results .r-title { font-weight: 700; color: var(--ink); }
.cdx-link-results .r-slug { font-size: 12px; color: var(--ink-soft); font-family: ui-monospace, Menlo, Consolas, monospace; }
.cdx-link-results .r-new { color: var(--wood); font-style: italic; display: block; }
.cdx-link-results .r-empty { color: var(--ink-soft); font-style: italic; cursor: default; display: block; }
.cdx-link-hint { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }

/* ---- template manager ---- */
.tpl-card {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 6px;
  background: linear-gradient(180deg, #fbf1d4, #f3e3bd);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 230, 0.5);
}
.tpl-card.tpl-new { background: linear-gradient(180deg, #f8da91, #e7b85d); margin-top: 18px; }
.tpl-name {
  width: 100%; box-sizing: border-box; font-weight: 800; font-size: 16px;
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 7px 10px; font-family: Georgia, serif; margin-bottom: 10px;
}
.tpl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-cols label { display: block; font-size: 12px; color: var(--wood-dark); font-weight: 700; }
.tpl-cols textarea {
  width: 100%; box-sizing: border-box; margin-top: 4px;
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 8px 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5;
}
.tpl-actions { margin-top: 10px; display: flex; gap: 8px; }
@media (max-width: 680px) { .tpl-cols { grid-template-columns: 1fr; } }

/* ---- page history + diffs ---- */
.codex-history { list-style: none; margin: 6px 0 0; padding: 0; }
.hist-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border-bottom: 1px solid var(--border-soft);
}
.hist-row.current { background: rgba(217, 164, 65, 0.12); }
.hist-when { font-weight: 700; color: var(--wood); white-space: nowrap; }
.hist-author { color: var(--ink-soft); font-size: 13px; }
.hist-author::before { content: "by "; color: var(--ink-soft); }
.hist-summary { color: var(--ink); font-style: italic; flex: 1 1 200px; }
.hist-links { margin-left: auto; }
.hist-links a { color: var(--wood); font-size: 13px; }
.hist-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
  border-radius: 3px; padding: 1px 6px; color: #fff;
}
.hist-tag.cur      { background: var(--new); }
.hist-tag.pending  { background: var(--modified); }
.hist-tag.rejected { background: var(--removed); }
.hist-tag.hidden   { background: #6b6b6b; }
.hist-row.hidden-rev { opacity: 0.62; }
.hist-row.hidden-rev .hist-when { text-decoration: line-through; }
.hist-links { display: inline-flex; align-items: baseline; gap: 8px; }
.hist-hide-form { display: inline; margin: 0; }
.hist-hide-btn {
  border: 1px solid var(--border-soft); background: #fff; color: var(--wood);
  font-size: 12px; padding: 1px 8px; border-radius: 3px; cursor: pointer;
}
.hist-hide-btn:hover { background: rgba(217, 164, 65, 0.18); }

.rev-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.rev-status {
  font-size: 10px; text-transform: uppercase; font-weight: 700; border-radius: 3px;
  padding: 1px 6px; color: #fff; background: var(--modified);
}
.rev-status.rejected { background: var(--removed); }

.codex-diff-head { color: var(--ink-soft); font-size: 13px; margin: 4px 0 12px; }
.codex-diff {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55;
  background: #fff6da; border: 1px solid var(--border); border-radius: 5px; padding: 12px 14px;
}
.codex-diff .dadd { color: var(--new);     font-weight: 700; display: block; background: rgba(47,143,58,.08); }
.codex-diff .ddel { color: var(--removed); font-weight: 700; display: block; background: rgba(168,50,50,.08); }
.codex-diff .dctx { color: var(--ink-soft); display: block; }

.codex-history-link { color: var(--wood); }
.codex-infobox {
  float: right; width: 300px; max-width: 42%;
  margin: 4px 0 18px 22px;
  background: #fff6da; border: 1px solid var(--border); border-radius: 5px;
  box-shadow: inset 0 0 0 2px rgba(255, 250, 230, 0.5), 3px 3px 0 rgba(73, 32, 10, 0.16);
  overflow: hidden; font-size: 13px; color: var(--ink);
}
/* additional infobox placements */
.codex-infobox.box-left  { float: left;  margin: 4px 22px 18px 0; }
.codex-infobox.box-right { float: right; margin: 4px 0 18px 22px; }
.codex-infobox.box-wide  { float: none; clear: both; width: 100%; max-width: none; margin: 6px 0 20px; }
.ib-title {
  background: linear-gradient(180deg, #5a260e, #401a08);
  color: var(--gold-bright); -webkit-text-fill-color: var(--gold-bright);
  text-align: center; font-weight: 800; padding: 8px 10px; font-size: 15px;
  letter-spacing: 0.02em; text-shadow: 0 1px 0 #2a1305;
}
.ib-figure { margin: 0; }
.ib-figure img { width: 100%; display: block; }
.ib-figure figcaption {
  padding: 5px 9px; font-size: 12px; font-style: italic;
  color: var(--ink-soft); text-align: center; background: #f3e3bd;
}
.ib-rows { width: 100%; border-collapse: collapse; }
.ib-rows th, .ib-rows td {
  padding: 6px 9px; vertical-align: top; text-align: left;
  border-top: 1px solid var(--border-soft); line-height: 1.45;
}
.ib-rows th { width: 38%; color: var(--wood-dark); font-weight: 700; }
.ib-rows td { color: var(--ink); }
.ib-head th {
  background: rgba(90, 38, 14, 0.1); text-align: center; color: var(--wood-dark);
  text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; width: auto;
}
.ib-full { text-align: center; font-style: italic; color: var(--ink-soft); }
.ib-rows a { color: var(--wood); }

/* keep these below the floated infobox */
.codex-holdings, .codex-cats-bar, .codex-backlinks { clear: both; }

@media (max-width: 680px) {
  .codex-infobox { float: none; width: auto; max-width: none; margin: 4px 0 16px; }
    .codex-infobox.box-left, .codex-infobox.box-right, .codex-infobox.box-wide {
      float: none; width: auto; max-width: none; margin: 4px 0 16px;
    }
}

/* edit form: infobox fields */
.cdx-infobox-field { margin: 4px 0 8px; }
.cdx-ib-line, .cdx-ib-body {
  display: block; width: 100%; box-sizing: border-box; margin: 6px 0;
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 8px 10px; font-family: Georgia, serif;
}
.cdx-ib-body { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.cat-admin { display: grid; gap: 6px; }
.cat-admin-child { margin-left: 26px; }
.cat-admin-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px; border-radius: 4px;
  background: linear-gradient(180deg, #fbf1d4, #f3e3bd);
  border: 1px solid var(--border);
}
.cat-reorder { display: flex; flex-direction: column; gap: 2px; }
.cat-reorder form { margin: 0; line-height: 1; }
.cat-reorder .cdx-mini-btn { padding: 0 7px; font-size: 12px; line-height: 1.5; }
.cat-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; margin: 0; }
.cat-edit .cat-name {
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 6px 9px; font-family: Georgia, serif; font-weight: 700; min-width: 160px;
}
.cat-edit select {
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 6px 8px; font-family: Georgia, serif;
}
.cat-meta code { background: rgba(90,38,14,.1); padding: 1px 5px; border-radius: 3px; }
.cat-parentnote { font-style: italic; }
.cat-del { margin: 0; }

/* ---- live holdings panel (entity link) ---- */
.codex-holdings {
  margin: 26px 0 8px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fbf1d4, #f1dfb4);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 230, 0.5), 3px 3px 0 rgba(73, 32, 10, 0.18);
  overflow: hidden;
}
.codex-holdings-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: linear-gradient(180deg, #5a260e, #401a08);
  border-bottom: 2px solid var(--border);
}
.codex-holdings-head h2 {
  margin: 0; color: var(--gold-bright); -webkit-text-fill-color: var(--gold-bright);
  font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; text-shadow: 0 1px 0 #2a1305;
}
.codex-holdings-live { color: #e9c987; font-style: italic; font-size: 12px; }
.codex-holdings-body { padding: 14px 16px 18px; }
.codex-holdings-status { color: var(--ink-soft); font-style: italic; padding: 6px 0; }
.codex-holdings-status.muted { color: #8a6a3a; }

.ch-group { margin-bottom: 16px; }
.ch-group:last-child { margin-bottom: 0; }
.ch-group h3 {
  margin: 0 0 8px; color: var(--wood-dark); -webkit-text-fill-color: var(--wood-dark);
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-soft); padding-bottom: 4px;
}
.ch-count {
  display: inline-block; min-width: 18px; text-align: center; margin-left: 4px;
  background: var(--wood); color: var(--gold-bright); border-radius: 9px;
  font-size: 11px; padding: 0 6px; vertical-align: middle;
}
.ch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ch-item {
  background: #fff6da; border: 1px solid var(--border-soft); border-radius: 4px; padding: 8px 10px;
}
.ch-name { font-weight: 800; color: var(--ink); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ch-badge {
  background: var(--mage); color: #fff; border-radius: 3px; font-size: 10px;
  padding: 1px 5px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700;
}
.ch-loc { margin-left: auto; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.ch-facts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; }
.ch-fact { color: var(--ink-soft); font-size: 12px; }
.ch-fact b { color: var(--wood-dark); font-weight: 700; }
.ch-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.ch-tag {
  background: rgba(90, 38, 14, 0.1); color: var(--wood-dark);
  border-radius: 3px; font-size: 11px; padding: 1px 6px;
}

/* edit form: live-data link field */
.cdx-entity-field { margin: 4px 0 8px; }
.cdx-entity-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.cdx-entity-row select,
.cdx-entity-row input {
  border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 8px 10px; font-family: Georgia, serif;
}
.cdx-entity-row input { flex: 1 1 260px; }
.cdx-upload {
  margin-bottom: 18px; padding: 14px 16px; border-radius: 6px;
  background: linear-gradient(180deg, #f8da91, #e7b85d);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.42), 4px 4px 0 rgba(73, 32, 10, 0.22);
}
.cdx-upload-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cdx-upload-row input[type="file"] { flex: 0 0 auto; color: var(--ink); font-weight: 700; }
.cdx-upload-row input[type="text"] {
  flex: 1 1 240px; border: 1px solid var(--border); background: #fff3c8; color: var(--ink);
  border-radius: 3px; padding: 8px 10px; font-family: Georgia, serif;
}
.cdx-upload .cdx-sub { margin-top: 8px; }

.cdx-file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px;
}
.cdx-file-card {
  border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #fbf1d4, #f3e3bd);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px rgba(255, 250, 230, 0.5), 3px 3px 0 rgba(73, 32, 10, 0.2);
  display: flex; flex-direction: column;
}
.cdx-file-thumb {
  display: flex; align-items: center; justify-content: center;
  height: 140px; background: rgba(58, 36, 18, 0.1); overflow: hidden; text-decoration: none;
}
.cdx-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cdx-file-icon { font-size: 22px; font-weight: 900; color: var(--wood); letter-spacing: 0.08em; }
.cdx-file-meta { padding: 10px 12px; display: grid; gap: 6px; }
.cdx-file-name { font-weight: 800; color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdx-copy-row { display: flex; gap: 6px; align-items: center; }
.cdx-copy-input {
  flex: 1 1 auto; min-width: 0; border: 1px solid var(--border-soft); background: #fff3c8;
  color: var(--ink-soft); border-radius: 3px; padding: 5px 7px; font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

@media (max-width: 760px) {
  .cdx-grid { grid-template-columns: 1fr 1fr; }
  .cdx-search { flex-direction: column; }
  .cdx-table, .cdx-table thead, .cdx-table tbody, .cdx-table th, .cdx-table td, .cdx-table tr { display: block; }
  .cdx-table thead { display: none; }
  .cdx-table tr { margin-bottom: 10px; }
}
