/* Custom admin pages (dashboard, control panel, media gallery, skills library, socials matrix, jobs).
   Loaded on every admin page through UNFOLD["STYLES"]. Colours are unfold's variables, which core/theme.py builds from
   the design theme. The status colours below are fixed OKLCH values on the design tokens' status hues (success 150,
   warning 70, danger 25; copied, not read from the tokens). Radii use the token scale (sm 6px, md 10px).
   `.dark` is unfold's dark mode class on <html>. */

:root {
  --ae-ok-bg: oklch(95% 0.05 150);   --ae-ok-fg: oklch(38% 0.1 150);
  --ae-warn-bg: oklch(95% 0.06 70);  --ae-warn-fg: oklch(42% 0.1 70);
  --ae-bad-bg: oklch(95% 0.04 25);   --ae-bad-fg: oklch(45% 0.16 25);
  --ae-surface: #fff;
  --ae-line: var(--color-base-200);
  --ae-text: var(--color-base-700);
  --ae-muted: var(--color-base-500);
}
.dark {
  --ae-ok-bg: oklch(32% 0.06 150);   --ae-ok-fg: oklch(88% 0.09 150);
  --ae-warn-bg: oklch(34% 0.06 70);  --ae-warn-fg: oklch(90% 0.09 70);
  --ae-bad-bg: oklch(32% 0.07 25);   --ae-bad-fg: oklch(88% 0.08 25);
  --ae-surface: var(--color-base-900);
  --ae-line: var(--color-base-800);
  --ae-text: var(--color-base-200);
  --ae-muted: var(--color-base-400);
}

.ae-intro { max-width: 65ch; margin: 0 0 16px; line-height: 1.55; color: var(--ae-muted); }
.ae-intro code, .ae-card code, .ae-table code { font-size: 12px; overflow-wrap: anywhere; }
.ae-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0 16px; }
.ae-bar label { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; font-weight: 500; }
.ae-bar select { min-height: 36px; max-width: 100%; padding: 0 8px; border: 1px solid var(--ae-line);
  border-radius: 6px; background: var(--ae-surface); color: var(--ae-text); }
.ae-bar input[type="text"], .ae-table input[type="text"], .ae-table input[type="number"], .ae-table select {
  min-height: 36px; width: 100%; max-width: 36ch; padding: 0 8px; border: 1px solid var(--ae-line);
  border-radius: 6px; background: var(--ae-surface); color: var(--ae-text); }
.ae-bar input[type="checkbox"], .ae-table input[type="checkbox"] { width: 24px; height: 24px; flex: none; }
.ae-bar label.ae-check { flex-direction: row; align-items: center; gap: 8px; }
.ae-bar select:focus-visible, .ae-bar input:focus-visible, .ae-table input:focus-visible, .ae-table select:focus-visible {
  outline: 2px solid var(--color-primary-500); outline-offset: 2px; }

.ae-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--ae-line); border-radius: 6px; background: var(--ae-surface); color: var(--ae-text);
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.ae-btn:hover { border-color: var(--color-base-400); }
.ae-btn:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-btn-primary, .ae-btn[aria-current="page"] { background: var(--color-primary-600);
  border-color: var(--color-primary-600); color: #fff; }
.ae-btn-primary:hover, .ae-btn[aria-current="page"]:hover { background: var(--color-primary-700); }
form.ae-inline { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.ae-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.ae-grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.ae-figure { margin: 0; }
.ae-thumb { max-width: 100%; border-radius: 6px; }
.ae-video { max-width: 100%; max-height: 480px; border-radius: 6px; }
.ae-grid-media { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.ae-card { min-width: 0; padding: 12px 16px; border: 1px solid var(--ae-line); border-radius: 10px;
  background: var(--ae-surface); color: var(--ae-text); }
.ae-card h2, .ae-h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.ae-h2 { margin-top: 24px; }
.ae-mt-0 { margin-top: 0; }
.ae-mt-4 { margin-top: 16px; }
.ae-mb-0 { margin-bottom: 0; }
.ae-mb-6 { margin-bottom: 24px; }
a.ae-card { display: block; text-decoration: none; }
a.ae-card:hover { border-color: var(--color-base-400); }
.ae-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--ae-line); }
.ae-row:first-of-type { border-top: 0; }
.ae-grow { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.ae-card .ae-muted { max-width: 70ch; }  /* a note in a card is a paragraph: keep its lines readable */
.ae-muted { display: block; color: var(--ae-muted); font-size: 12px; overflow-wrap: anywhere; }
.ae-stat { font-size: 24px; font-weight: 600; line-height: 1.2; }
.ae-stats { display: grid; grid-template-columns: repeat(var(--ae-cols, 2), minmax(0, 1fr)); gap: 12px 16px; margin: 8px 0; }
.ae-stats-3 { --ae-cols: 3; }  /* a column count that divides the items, so no lone item on the last row */
.ae-health { margin: 0 0 12px; }

.ae-badge { display: inline-block; min-width: 24px; min-height: 24px; box-sizing: border-box; text-align: center; padding: 2px 8px; border: 1px solid var(--ae-line); border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; }
.ae-ok { background: var(--ae-ok-bg); color: var(--ae-ok-fg); border-color: transparent; }
.ae-warn { background: var(--ae-warn-bg); color: var(--ae-warn-fg); border-color: transparent; }
.ae-bad { background: var(--ae-bad-bg); color: var(--ae-bad-fg); border-color: transparent; }

.ae-table-wrap { overflow-x: auto; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface); }
.ae-table { width: 100%; border-collapse: collapse; color: var(--ae-text); }
.ae-table th, .ae-table td { padding: 8px 12px; border-bottom: 1px solid var(--ae-line); text-align: left; vertical-align: top; }
.ae-table thead th { font-weight: 600; white-space: nowrap; }
/* links in tables and cards are tap targets: at least 24px tall (WCAG 2.5.8) */
.ae-table a, .ae-card h2 a, .ae-card p a { display: inline-flex; align-items: center; min-height: 24px; }
.ae-card p a.ae-btn { min-height: 36px; }  /* the rule above would otherwise win over .ae-btn */
.ae-card h2 a { min-height: 32px; }
@media (pointer: coarse) { .ae-card p a.ae-btn, .ae-card h2 a { min-height: 44px; } }
.ae-table tbody tr:last-child td, .ae-table tbody tr:last-child th { border-bottom: 0; }
.ae-pre { margin: 0; padding: 12px; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface);
  color: var(--ae-text); white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 12px; }

.ae-media { display: grid; place-items: center; aspect-ratio: 1 / 1; background: var(--color-base-100); }
.dark .ae-media { background: var(--color-base-800); }
.ae-media img, .ae-media video { width: 100%; height: 100%; object-fit: contain; }  /* the whole picture or card: never cropped */
.ae-media-card { padding: 0; overflow: hidden; }
.ae-media-card .ae-meta { padding: 8px 12px; font-size: 13px; }

/* Content -> Published: a story as a picture card (its photo, else its card, else this plain tile). */
.ae-published { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.ae-media-wide { aspect-ratio: 16 / 9; }
.ae-story-card .ae-meta { display: grid; gap: 6px; align-content: start; }
.ae-story-card .ae-meta > a:not(.ae-btn) { display: block; min-height: 24px; }  /* a headline is a tap target (WCAG 2.5.8) */
.ae-story-card .ae-actions { margin: 4px 0 0; }
.ae-placeholder { display: grid; align-content: space-between; gap: 8px; width: 100%; height: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--color-primary-700), var(--color-primary-950)); color: #fff; text-align: start; overflow: hidden; }
.ae-placeholder small { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.ae-placeholder b { font-size: 16px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* unfold's own controls, lifted to the house rules (rule 01): 24px tap targets (WCAG 2.5.8) and a visible keyboard
   focus. Scoped to unfold's stable ids/classes; re-run the design reviewer after upgrading django-unfold. The "..."
   toggle (lg:hidden) is left out: an id selector would beat its class and show it on desktop, where it does nothing. */
#header-inner a:not(.lg\:hidden), .toplinks a, #result_list thead th a, .sortoptions a, .sortremove {
  display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; }
#searchbar-submit { min-height: 24px; min-width: 24px; justify-content: center; }
#result_list input[type="checkbox"], #action-toggle { width: 24px; height: 24px; min-width: 24px; }
#searchbar:focus-visible, #searchbar-submit:focus-visible, .sortremove:focus, #result_list input:focus-visible,
#action-toggle:focus-visible, #content input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-primary-500); outline-offset: 2px; transition: none; }
/* unfold's on/off switch (BooleanField): 24px tall, knob re-centred */
#content input[type="checkbox"].rounded-full { height: 24px; width: 44px; min-width: 44px; }
#content input[type="checkbox"].rounded-full::after { width: 16px; height: 16px; top: 4px; left: 4px; }
#content input[type="checkbox"].rounded-full:checked::after { left: 24px; }
#result_list tbody a { display: inline-flex; align-items: center; min-height: 24px; }
/* unfold's index (the app list, used when the project has no per-site dashboard): section, model and add/change links */
#content .module h2 a.section, #content .module th[scope="row"] a { display: inline-flex; align-items: center; min-height: 24px; }
#content .module td a.changelink, #content .module td a.addlink { height: 24px; min-height: 24px; }

/* the review page: article preview, reviewer panel, actions */
.ae-split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .ae-split { grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); align-items: start; } }
.ae-article { max-width: 56ch; line-height: 1.6; color: var(--ae-text); }
.ae-article h1 { margin: 0 0 4px; font-size: 24px; line-height: 1.25; }
.ae-article h2, .ae-article h3 { margin: 20px 0 6px; font-size: 18px; }
.ae-article p, .ae-article ul, .ae-article ol, .ae-article blockquote { margin: 0 0 12px; }
.ae-article blockquote { padding-left: 12px; border-left: 3px solid var(--ae-line); color: var(--ae-muted); }
.ae-dek { margin: 0 0 16px; font-style: italic; color: var(--ae-muted); }
.ae-article a { text-decoration: underline; }
.ae-article ins, .ae-card ins { background: var(--ae-ok-bg); color: var(--ae-ok-fg); text-decoration: none; }
.ae-article del, .ae-card del { background: var(--ae-bad-bg); color: var(--ae-bad-fg); }
.ae-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-weight: 500; }
.ae-field input[type="text"], .ae-field input[type="number"], .ae-field textarea, .ae-field select {
  width: 100%; max-width: 100%; padding: 8px; border: 1px solid var(--ae-line); border-radius: 6px;
  background: var(--ae-surface); color: var(--ae-text); font: inherit; font-weight: 400; }
#content .ae-field input[type="text"], #content .ae-field input[type="number"], #content .ae-field select { min-height: 36px; }
.ae-field textarea { min-height: 96px; resize: vertical; }
.ae-field input:focus-visible, .ae-field textarea:focus-visible, .ae-field select:focus-visible {
  outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; }
.ae-check input { width: 24px; height: 24px; min-width: 24px; }
.ae-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.ae-btn-bad { background: var(--ae-bad-bg); color: var(--ae-bad-fg); border-color: transparent; }
.ae-details { margin: 0 0 12px; }
.ae-details summary { display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; font-weight: 600; }
.ae-bar-track { height: 8px; border-radius: 4px; background: var(--color-base-200); overflow: hidden; }
.dark .ae-bar-track { background: var(--color-base-800); }
.ae-bar-fill { height: 100%; background: var(--color-primary-600); }
.ae-scorerow { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 2rem; gap: 8px; align-items: center; margin: 4px 0; }
.ae-list { margin: 0; padding-left: 20px; }
.ae-list li { margin: 2px 0; overflow-wrap: anywhere; }
ol.ae-list { list-style: decimal; }  /* the preflight removes list markers: a numbered flow needs its numbers */
.ae-list a, .ae-article a { display: inline-flex; align-items: center; min-height: 24px; }
.ae-details summary { padding: 0 4px; }
.ae-details { min-height: 36px; }
/* checkbox lists in forms (unfold draws them 20px): 24px tap targets */
#content input[type="checkbox"]:not(.rounded-full) { width: 24px; height: 24px; min-width: 24px; }
.ae-table-wrap { overflow-x: auto; }

/* a table whose rows each hold a form control: one block per row on a phone, so the control gets the full width */
@media (max-width: 700px) {
  .ae-table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ae-table-stack, .ae-table-stack tbody, .ae-table-stack tr, .ae-table-stack td { display: block; width: 100%; }
  .ae-table-stack td { padding-block: 6px; border: 0; }
  .ae-table-stack tr { padding-block: 8px; border-top: 1px solid var(--ae-line); }
  .ae-table-stack td input[type="text"], .ae-table-stack td input[type="number"], .ae-table-stack td select { max-width: 100%; }
}

.ae-details > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; font-weight: 600; cursor: pointer; }
.ae-details > summary:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-details[open] > summary { margin-bottom: 8px; }

/* the sidebar title link is small text once a version sits under it: keep it a 24px tap target */
#site-name > a { display: inline-block; min-height: 24px; line-height: 24px; }

/* live tables (core/admin.js): dim the list while a search/filter/sort request is out */
#main:has(form.htmx-request, a.htmx-request) { cursor: progress; }
#main:has(form.htmx-request, a.htmx-request) #result_list, #main:has(form.htmx-request, a.htmx-request) .ae-table-wrap { opacity: 0.55; transition: opacity 0.15s; }
.ae-table .ae-group th { background: var(--color-base-50); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ae-muted); }
.dark .ae-table .ae-group th { background: var(--color-base-800); }

/* Site -> Design: the live sample (core/site_preview.js). Its colours come from the chosen theme, its fonts and sizes
   from the choices; nothing here is the real page. */
.ae-prev { --prev-primary: #3b5bdb; --prev-primary-dark: #2f49b0; --prev-primary-deep: #1b2a6b; --prev-tint: #f1f4ff;
  --prev-ink: #1f2430; --prev-muted: #6b7280; --prev-line: #e4e7ee;
  max-width: 44rem; padding: 0; border: 1px solid var(--prev-line); border-radius: 10px; overflow: hidden;
  background: #fff; color: var(--prev-ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.ae-prev-mast { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--prev-line); }
.ae-prev-logo { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: var(--prev-primary); color: #fff; font-weight: 800; }
.ae-prev-name { font-family: var(--prev-font-name, inherit); font-size: calc(20px * var(--prev-scale-name, 1)); font-weight: 800; }
.ae-prev-nav { display: flex; gap: 14px; margin-inline-start: auto; color: var(--prev-muted);
  font-family: var(--prev-font-menu, inherit); font-size: calc(13px * var(--prev-scale-menu, 1)); }
.ae-prev-body-wrap { display: grid; gap: 8px; padding: 16px; background: var(--prev-page, var(--prev-tint)); color: var(--prev-ink); }
.ae-prev-kicker { margin: 0; color: var(--prev-primary-dark); font-family: var(--prev-font-menu, inherit);
  font-size: calc(12px * var(--prev-scale-menu, 1)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ae-prev-headline { margin: 0; font-family: var(--prev-font-headline, var(--prev-theme-headline, Georgia, serif)); font-size: calc(26px * var(--prev-scale-headline, 1));
  font-weight: 600; line-height: 1.15; }
.ae-prev-dek { margin: 0; color: var(--prev-muted); font-family: var(--prev-font-headline, var(--prev-theme-headline, Georgia, serif));
  font-size: calc(16px * var(--prev-scale-headline, 1)); }
.ae-prev-text { margin: 0; font-family: var(--prev-font-body, inherit); font-size: calc(15px * var(--prev-scale-body, 1)); line-height: 1.6; }
.ae-prev-btn { justify-self: start; padding: 6px 14px; border-radius: 999px; background: var(--prev-button, var(--prev-primary)); color: #fff;
  font-family: var(--prev-font-menu, inherit); font-size: calc(13px * var(--prev-scale-menu, 1)); font-weight: 600; }
.ae-prev-card { display: grid; align-content: space-between; gap: 24px; width: min(16rem, calc(100% - 32px)); aspect-ratio: 1.6 / 1; margin: 16px;
  padding: 14px; border-radius: 8px; background: linear-gradient(135deg, var(--prev-primary-dark), var(--prev-primary-deep)); color: #fff; }
.ae-prev-card-site { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.ae-prev-card-title { font-size: 18px; font-weight: 800; line-height: 1.15; }

/* Control panel: the area picker, one area's switches in groups, and the About panel. */
.ae-picker { margin: 0 0 16px; }
.ae-picker-links { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ae-tile { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 6px 12px; height: auto; text-align: left; }
.ae-tile small { font-size: 12px; }
.ae-picker-select { display: flex; gap: 8px; align-items: end; }
.ae-picker-select label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; font-weight: 500; }
.ae-picker-select select, .ae-find { font-size: 16px; }
.ae-picker-select select { width: 100%; max-width: 100%; min-height: 36px; padding: 0 8px; border: 1px solid var(--ae-line);
  border-radius: 6px; background: var(--ae-surface); color: var(--ae-text); }
.ae-picker-select select:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-panel-split { display: grid; gap: 16px; }
.ae-switches { display: grid; gap: 16px; align-content: start; min-width: 0; }
.ae-about { display: none; }
.ae-about-narrow summary { min-height: 24px; font-weight: 600; cursor: pointer; }
.ae-about-text { max-width: 56ch; margin: 0 0 12px; line-height: 1.55; }
.ae-about-h { margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.ae-about-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 768px) {
  .ae-picker-links { display: grid; }
  .ae-picker-select { display: none; }
}
@media (min-width: 1024px) {
  .ae-panel-split { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; }
  .ae-about { display: block; }
  .ae-sticky { position: sticky; top: 16px; }
  .ae-about-narrow { display: none; }
}
.ae-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ae-filterbar { align-items: center; margin: 0; }
.ae-btn[hidden], .ae-find[hidden], .ae-flag[hidden], .ae-flaggroup[hidden] { display: none; }
.ae-help { display: inline-block; vertical-align: middle; }
.ae-help summary { display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; box-sizing: border-box;
  border: 1px solid var(--ae-line); border-radius: 999px; color: var(--ae-muted); font-size: 12px; cursor: pointer; list-style: none; }
.ae-help summary::-webkit-details-marker { display: none; }
.ae-help summary:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-help[open] { display: block; margin-top: 4px; }
.ae-flaggroup { border-top: 1px solid var(--ae-line); }
.ae-flaggroup > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; padding: 6px 0;
  cursor: pointer; list-style: none; }
.ae-flaggroup > summary::-webkit-details-marker { display: none; }
.ae-flaggroup > summary::before { content: "\25B8"; flex: none; width: 16px; color: var(--ae-muted); }
.ae-flaggroup[open] > summary::before { content: "\25BE"; }
.ae-flaggroup > summary:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 2px; }
.ae-flaggroup-note { margin: 0 0 4px; padding-left: 16px; }
.ae-about-list a { display: inline-flex; align-items: center; min-height: 24px; }
.ae-child { padding-left: 16px; }
.ae-chain { flex: 1 0 100%; min-width: 0; }
.ae-chain-line { margin: 0; line-height: 1.8; overflow-wrap: anywhere; }
.ae-chain-why-h { margin: 4px 0 0; font-size: 13px; }
.ae-chain-why { margin: 0; padding-left: 18px; color: var(--ae-warn-fg); font-size: 13px; }
.ae-defaults { margin-bottom: 16px; }
.ae-area-card .ae-row { margin-bottom: 8px; }

/* The Guide page's search (core/static/core/guide_search.js): hides what does not match; matches are marked. */
.ae-gs-hidden { display: none !important; }
.ae-guide-search { align-items: center; }
.ae-guide-search label { flex: 1 1 24rem; }
.ae-guide-search input[type="search"] { min-height: 36px; width: 100%; max-width: 48ch; padding: 0 8px; border: 1px solid var(--ae-line);
  border-radius: 6px; background: var(--ae-surface); color: var(--ae-text); }
.ae-guide-search input[type="search"]:focus-visible { outline: 2px solid var(--color-primary-600); outline-offset: 1px; }
::highlight(ae-guide-hit) { background-color: #fde68a; color: #111827; }

/* Story page: one blue button per view, long labels wrap instead of spilling out of the card, and a marker on what opens. */
.ae-actions .ae-btn { max-width: 100%; white-space: normal; text-align: center; }
.ae-details > summary::before { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform 0.15s; flex: none; }
.ae-details[open] > summary::before { transform: rotate(45deg); }
.ae-details > summary { list-style: none; }
.ae-details > summary::-webkit-details-marker { display: none; }
.ae-check input, table input[type="checkbox"] { accent-color: var(--color-primary-600); }
.ae-jump { display: none; }
@media (max-width: 1023px) { .ae-jump { display: inline-flex; } }
@media (prefers-reduced-motion: reduce) { .ae-details > summary::before { transition: none; } }

/* Topics card: chips with their fit, and a form per chip so Unlink is one press. */
.ae-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0; padding: 0; }
.ae-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border: 1px solid var(--ae-line); border-radius: 999px; }
.ae-inline { display: inline; margin: 0; }

/* The story editor (core/static/core/rich_editor.js): one frame like a code host's comment box: an icon toolbar that
   stays in view, the page as it will look growing with its text, a link box under the selected words, and a footer. */
.ae-ed-label { margin: 12px 0 4px; font-weight: 500; }
.ae-ed { position: relative; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface); }
.ae-ed:focus-within { border-color: var(--color-primary-500); box-shadow: 0 0 0 1px var(--color-primary-500); }
.ae-ed-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 4px 6px; border-bottom: 1px solid var(--ae-line); border-radius: 10px 10px 0 0; background: var(--ae-surface); }
.ae-ed-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ae-text); cursor: pointer; }
.ae-ed-btn:hover:not(:disabled), .ae-ed-style:hover:not(:disabled), .ae-ed-mode:hover:not(:disabled) { background-color: var(--color-base-100); }
.dark .ae-ed-btn:hover:not(:disabled), .dark .ae-ed-style:hover:not(:disabled), .dark .ae-ed-mode:hover:not(:disabled) { background-color: var(--color-base-800); }
.ae-ed-btn[aria-pressed="true"] { border-color: var(--color-primary-200); background: var(--color-primary-50); color: var(--color-primary-700); }
.dark .ae-ed-btn[aria-pressed="true"] { border-color: var(--color-primary-700); background: var(--color-primary-950); color: var(--color-primary-200); }
.ae-ed-btn:focus-visible, .ae-ed-style:focus-visible, .ae-ed-mode:focus-visible { outline: 2px solid var(--color-primary-500); outline-offset: 1px; }
.ae-ed-btn:disabled, .ae-ed-style:disabled { opacity: .4; cursor: not-allowed; }
.ae-ed-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--ae-line); }
.ae-ed-style { height: 32px; max-width: 100%; padding: 0 8px; border: 1px solid transparent; border-radius: 6px;
  background-color: transparent; color: var(--ae-text); font-weight: 500; cursor: pointer; }
.dark .ae-ed-style { color-scheme: dark; }
.ae-ed .ae-rich-area { max-width: none; min-height: 24rem; padding: 16px 20px; outline: none; font-size: 15px; }
.ae-ed .ae-rich-area > * { max-width: 75ch; }
.ae-ed .ae-rich-area h2 { font-size: 20px; }
.ae-ed .ae-rich-area h3 { font-size: 17px; }
.ae-ed .ae-rich-area a { color: var(--color-primary-600); text-decoration: underline; }
.dark .ae-ed .ae-rich-area a { color: var(--color-primary-400); }
.ae-ed [data-rich-source] { display: block; margin: 0; }
.ae-ed [data-rich-source] textarea { display: block; box-sizing: border-box; width: 100%; min-height: 24rem; margin: 0;
  padding: 16px 20px; border: 0; resize: vertical; background: transparent; color: var(--ae-text); outline: none;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ae-ed-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ae-ed-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 4px 8px;
  border-top: 1px solid var(--ae-line); font-size: 13px; }
.ae-ed-mode { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 0;
  border-radius: 6px; background: transparent; color: var(--ae-muted); cursor: pointer; }
.ae-ed-mode:hover:not(:disabled) { color: var(--ae-text); }
.ae-ed-count { margin-left: auto; }
.ae-ed-pop { position: absolute; z-index: 4; box-sizing: border-box; width: min(30rem, calc(100% - 16px)); margin: 0;
  padding: 10px 12px; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.ae-ed-pop.ae-ed-bubble { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: auto; max-width: calc(100% - 16px); padding: 4px 6px 4px 12px; }
.ae-ed-pop p { margin: 0 0 8px; }
.ae-ed-href { min-width: 0; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ae-muted); font-size: 13px; }
.ae-ed-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ae-ed-pop .ae-rich-results { max-height: 16rem; overflow: auto; margin-top: 8px; }
::highlight(ae-ed-target) { background-color: var(--color-primary-200); color: inherit; }
.ae-ed-end { margin-left: auto; }
.ae-ed-foot a.ae-ed-mode { text-decoration: none; }
/* Full screen: the whole edit form fills the window; its toolbar stays at the top and the save buttons at the bottom. */
.ae-ed-fullbar { display: none; }
form.ae-ed-full { position: fixed; inset: 0; z-index: 1000; overflow: auto; margin: 0;
  padding: 0 max(16px, calc((100vw - 1100px) / 2)); background: var(--ae-surface); }
form.ae-ed-full .ae-ed-fullbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 8px; padding: 12px 0; border-bottom: 1px solid var(--ae-line); }
.ae-ed-fullbar b { font-size: 15px; }
form.ae-ed-full .ae-rich-area, form.ae-ed-full [data-rich-source] textarea { min-height: 60vh; }
form.ae-ed-full .ae-rich-area > * { margin-left: auto; margin-right: auto; }  /* one centred column, like a document */
form.ae-ed-full > .ae-actions { position: sticky; bottom: 0; z-index: 3; margin: 16px 0 0; padding: 12px 0;
  border-top: 1px solid var(--ae-line); background: var(--ae-surface); }
html.ae-ed-noscroll, html.ae-ed-noscroll body { overflow: hidden; }
/* The social texts under the editor: a count under each box, and the brain's buttons. */
.ae-social-head { margin: 4px 0 8px; align-items: center; }
.ae-social-status { margin: 0; }
.ae-social-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; font-size: 13px; }
.ae-social-tools .ae-muted:only-child { margin-left: auto; }
.ae-social-head .ae-btn, .ae-social-tools .ae-ed-mode { gap: 6px; }
.ae-social-icon { flex: none; color: var(--color-primary-600); }
.dark .ae-social-icon { color: var(--color-primary-400); }
.ae-over { color: var(--ae-bad-fg); font-weight: 600; }
.ae-rich-results li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0 0 6px; }
.ae-rich-results .ae-btn { white-space: normal; text-align: left; height: auto; padding-top: 6px; padding-bottom: 6px; }

/* A button that cannot be pressed looks it (the editor's toolbar in Markdown view). */
.ae-btn:disabled { opacity: .5; cursor: not-allowed; }
.ae-btn[aria-pressed="true"] { background: var(--color-primary-600); color: #fff; border-color: transparent; }
.ae-chips li, .ae-rich-results { list-style: none; }
.ae-rich-results { margin: 0; padding: 0; }
.ae-rich-panel input[type="text"] { min-height: 36px; width: 100%; max-width: 32rem; padding: 0 8px; border: 1px solid var(--ae-line);
  border-radius: 6px; background: var(--ae-surface); color: var(--ae-text); }
#decision, #topics, #edit { scroll-margin-top: 16px; }
html.dark .ae-table input, html.dark .ae-rich-panel input, html.dark .ae-chip { color-scheme: dark; }

/* Phones and touch screens: 44px targets, 16px inputs (iOS zooms into anything smaller). */
@media (pointer: coarse) {
  .ae-btn, .ae-chip button, .ae-rich-results .ae-btn { min-height: 44px; }
  .ae-ed-btn { width: 44px; height: 44px; }
  .ae-ed-style, .ae-ed-mode { min-height: 44px; }
  .ae-rich-panel input[type="text"], .ae-ed .ae-rich-area, .ae-ed [data-rich-source] textarea { font-size: 16px; }
  .ae-rich-panel input[type="text"] { min-height: 44px; }
  .ae-table input[type="checkbox"] { width: 24px; height: 24px; }
}

/* The review queue's action bar (pipeline/story/queue.html): one row above the list that stays in view, Approve, and the
   other actions in small menus that open on a click. Dimmed until a story is ticked. */
.ae-bulkbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 8px 0 12px; padding: 8px 12px; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.06); }
.ae-bulk-count { min-width: 5.5rem; color: var(--ae-muted); }
.ae-bulk-count b { color: var(--ae-text); }
.ae-bulk-end { margin-left: auto; }
.ae-bulkbar.ae-bulk-none .ae-menu > summary { color: var(--ae-muted); cursor: not-allowed; }  /* muted, still readable */
.ae-menu { position: relative; }
.ae-menu > summary { list-style: none; gap: 6px; cursor: pointer; user-select: none; }
.ae-menu > summary::-webkit-details-marker { display: none; }
.ae-menu > summary::after { content: ""; width: 0.4em; height: 0.4em; margin-top: -0.2em; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.ae-menu[open] > summary { border-color: var(--color-primary-500); }
.ae-menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; display: flex; flex-direction: column;
  align-items: flex-start; gap: 8px; box-sizing: border-box; width: min(24rem, calc(100vw - 32px));
  padding: 12px; border: 1px solid var(--ae-line); border-radius: 10px; background: var(--ae-surface); box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.ae-menu-wide { width: min(32rem, calc(100vw - 32px)); }
.ae-menu-panel.ae-menu-left { left: auto; right: 0; }  /* opened near the right edge: it grows leftwards */
.ae-bulkbar .ae-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.ae-menu-panel .ae-btn { justify-content: flex-start; text-align: left; }
.ae-menu-panel p, .ae-menu-panel .ae-field { margin: 0; }
.ae-menu-panel .ae-field { width: 100%; }
.ae-menu-panel input[type="text"] { width: 100%; max-width: none; }
.ae-menu-list { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.5; }
.ae-menu-list li + li { margin-top: 4px; }
@media (max-width: 639px) {
  .ae-menu-panel { position: fixed; top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-width: none; }
  .ae-bulk-end { margin-left: 0; }
}
