/* DocMX Help. Design tokens are DocMX Extract's (src/docmxExtract.Web/wwwroot/app.css) so the help
   centre reads as part of the same family. Do not invent new brand colours here. */

:root {
    /* Fonts */
    --font-title: 'Roboto', system-ui, sans-serif;
    --font-subtitle: 'Hind', system-ui, sans-serif;
    --font-body: 'Open Sans', system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Primary brand */
    --color-brand: #074684;
    --color-brand-dark: #053562;
    --color-brand-teal: #0ea5c6;
    --color-brand-accent: #a0edf7;

    /* Surfaces */
    --color-surface: #ffffff;
    --color-surface-raised: #f8fafc;
    --color-border: #e2e8f0;

    /* Text */
    --color-text-primary: #0f172a;
    --color-text-secondary: #64748b;
    --color-link: #075a9e;

    /* Callouts (semantic, never replace with brand) */
    --color-info-bg: #eff6ff;
    --color-info-border: #93c5fd;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fbbf24;
    --color-tip-bg: #ecfdf5;
    --color-tip-border: #34d399;

    --app-header-height: 56px;
    --radius: 0.5rem;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-raised: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    --focus-ring: 0 0 0 3px rgba(14, 165, 198, 0.45);
    --page-width: 1200px;
}

/* ── Base ── */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-padding-top: calc(var(--app-header-height) + 1rem);
}

body {
    background: var(--color-surface-raised);
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    outline: none;
}

h1, h2, h3, h4 {
    font-family: var(--font-title);
    line-height: 1.25;
    color: var(--color-text-primary);
    margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.75rem, 2.5vw + 1rem, 2.25rem); font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

a {
    color: var(--color-link);
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--color-brand);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 4px;
}

/* Headings receive programmatic focus after navigation (FocusOnNavigate); no ring for that. */
h1:focus, main:focus {
    box-shadow: none;
}

img {
    max-width: 100%;
    height: auto;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 200;
    background: var(--color-surface);
    color: var(--color-brand);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    box-shadow: var(--shadow-raised);
}

.skip-link:focus {
    top: 0.5rem;
}

.muted { color: var(--color-text-secondary); }

.meta {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin: 0;
}

.lead {
    font-family: var(--font-subtitle);
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    margin: 0 0 0.75rem;
}

.lead p { margin: 0 0 0.5rem; }

.eyebrow {
    font-family: var(--font-subtitle);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    /* Darker than the brand teal so small text meets WCAG AA contrast (5.4:1 on white). */
    color: #0e7490;
    margin: 0 0 0.25rem;
}

/* ── Top bar (as DocMX Extract) ── */

.top-bar {
    background-color: var(--color-brand);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(7, 70, 132, 0.15);
}

.top-bar-inner {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: env(safe-area-inset-top) max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
    min-height: var(--app-header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* The pages keep their distance from the brand; search, language and account sit together on the right (#839). */
.top-bar-inner > .top-nav { margin-left: 0.75rem; }

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}

.brand:hover { color: #fff; }

.brand-logo { display: block; }

.brand-product {
    font-family: var(--font-subtitle);
    font-weight: 600;
    font-size: 1.125rem;
    padding-left: 0.625rem;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    line-height: 1.2;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.top-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
}

.top-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* The current page (#839): an accent underline, so the reader can see where they are. */
.top-nav a[aria-current="page"] {
    color: #fff;
    box-shadow: inset 0 -3px 0 var(--color-brand-accent);
    border-radius: var(--radius) var(--radius) 0 0;
}

.top-bar-search {
    margin-left: auto;
    width: min(320px, 40vw);
}

/* On a wide screen the search box gives way first, so a learner's extra "My learning" link (#604) keeps the menu on one line. */
@media (min-width: 1100px) {
    .top-nav { flex-shrink: 0; }

    .top-bar-search { width: auto; flex: 0 1 320px; min-width: 10rem; }
}

/* Tablets (#944): between the phone layout and the wide screen the page links stayed beside the search box and wrapped
   into two rows. Keep them on one row next to the brand, scrolling sideways if they still do not fit, with the language
   and account on the right, and give the search box a full-width row of its own underneath. */
@media (min-width: 721px) and (max-width: 1099px) {
    .top-bar-inner {
        flex-wrap: wrap;
        row-gap: 0;
        padding-bottom: 0.625rem;
    }

    .top-bar-inner > .top-nav {
        flex: 1 1 0;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .top-nav::-webkit-scrollbar { display: none; }

    .language-switcher, .account-signin, .account-menu { flex-shrink: 0; }

    .top-bar-search {
        order: 5;
        width: 100%;
        margin: 0;
    }
}


/* ── Language switcher (a native disclosure, no script) ── */

.language-switcher { position: relative; flex-shrink: 0; }

.language-switcher summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
}

.language-switcher summary::-webkit-details-marker { display: none; }

.language-switcher summary:hover, .language-switcher[open] summary { background: rgba(255, 255, 255, 0.12); color: #fff; }

.language-switcher summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.language-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.375rem);
    z-index: 50;
    min-width: 11rem;
    margin: 0;
    padding: 0.375rem;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

.language-menu a {
    display: block;
    padding: 0.4rem 0.625rem;
    border-radius: calc(var(--radius) - 2px);
    color: var(--color-text-primary);
    text-decoration: none;
}

.language-menu a:hover { background: var(--color-surface-raised); }

.language-menu a[aria-current] { font-weight: 700; color: var(--color-brand); }

/* ── Account (#839): Sign in when signed out, else a badge opening a native disclosure ── */

.account-signin {
    flex-shrink: 0;
    color: #fff;
    background-color: var(--color-brand);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.375rem 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
}

.account-signin:hover { background: #fff; color: var(--color-brand); border-color: #fff; }

.account-signin:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.account-menu { position: relative; flex-shrink: 0; }

.account-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.375rem;
    border-radius: 999px;
    cursor: pointer;
}

.account-menu summary::-webkit-details-marker { display: none; }

.account-menu summary:hover, .account-menu[open] summary { background: rgba(255, 255, 255, 0.12); color: #fff; }

.account-menu summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.account-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-brand-accent);
    color: var(--color-brand-dark);
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.account-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.375rem);
    z-index: 50;
    min-width: 14rem;
    padding: 0.375rem;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

.account-name {
    margin: 0 0 0.25rem;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.account-panel ul { list-style: none; margin: 0; padding: 0; }

.account-panel ul:empty { display: none; }

.account-panel a, .account-signout {
    display: block;
    width: 100%;
    padding: 0.4rem 0.625rem;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    background: none;
    color: var(--color-text-primary);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-panel a:hover, .account-signout:hover { background: var(--color-surface-raised); }

.account-panel form { margin: 0; }

.translation-notice {
    margin: 0 0 1rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    font-size: 0.9375rem;
}

/* Chinese, Japanese and Korean: the site fonts have no glyphs for them, so name good system fonts first. */
:lang(zh-CN) { --font-title: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif; --font-subtitle: var(--font-title); --font-body: var(--font-title); }

:lang(zh-TW) { --font-title: 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', system-ui, sans-serif; --font-subtitle: var(--font-title); --font-body: var(--font-title); }

:lang(ja) { --font-title: 'Hiragino Sans', 'Yu Gothic UI', Meiryo, 'Noto Sans JP', system-ui, sans-serif; --font-subtitle: var(--font-title); --font-body: var(--font-title); }

:lang(ko) { --font-title: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif; --font-subtitle: var(--font-title); --font-body: var(--font-title); }

/* English inside a CJK page (untranslated content) keeps the site fonts. */
:lang(en) { --font-title: 'Roboto', system-ui, sans-serif; --font-subtitle: 'Hind', system-ui, sans-serif; --font-body: 'Open Sans', system-ui, sans-serif; }

/* ── Search box ── */

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    font-family: var(--font-body);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-brand-teal);
    box-shadow: var(--focus-ring);
}

.search-box-compact input {
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
    font-size: 0.875rem;
    border-color: transparent;
}

.search-box-hero {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
    padding: 0.375rem;
    max-width: 640px;
}

.search-box-hero .search-icon { left: 1.125rem; }

.search-box-hero input {
    border: none;
    padding: 0.75rem 0.75rem 0.75rem 2.75rem;
    font-size: 1.0625rem;
}

.search-box-hero input:focus { box-shadow: none; }

.search-box-hero:focus-within { box-shadow: var(--shadow-raised), var(--focus-ring); }

.search-box button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-brand);
    border: 1px solid var(--color-brand);
    border-radius: var(--radius);
    padding: 0.6rem 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.search-box button:hover, .button:hover {
    background: var(--color-brand-dark);
    border-color: var(--color-brand-dark);
    color: #fff;
}

.button-secondary {
    background: var(--color-surface);
    color: var(--color-brand);
    border-color: #cbd5e1;
}

.button-secondary:hover {
    background: var(--color-surface-raised);
    color: var(--color-brand);
    border-color: #94a3b8;
}

/* ── Hero ── */

.hero {
    background: linear-gradient(135deg, var(--color-brand) 0%, #0a5aa5 55%, var(--color-brand-teal) 140%);
    color: #fff;
    padding: 3.5rem 0 4rem;
}

.hero-inner {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hero h1 {
    color: #fff;
    font-size: clamp(2rem, 3vw + 1rem, 2.75rem);
}

.hero-lead {
    font-family: var(--font-subtitle);
    font-size: 1.1875rem;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 1.5rem;
    max-width: 40rem;
}

/* ── Page shell ── */

.page {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.page.narrow { max-width: 760px; }

.page-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 0.5rem 0 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    margin: 0 0 1rem;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}

.card + .card { margin-top: 1.25rem; }

.category-grid > .card, .course-grid > .card { margin-top: 0; }

.card h2 { font-size: 1.125rem; }

.link-arrow {
    font-weight: 600;
    text-decoration: none;
}

.link-arrow::after { content: " \2192"; }

/* A card whose title link covers the whole card. */
.stretched::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
}

/* ── Breadcrumbs ── */

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.breadcrumbs li + li::before {
    content: "/";
    margin-right: 0.25rem;
    color: #cbd5e1;
}

.breadcrumbs a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--color-brand);
    text-decoration: underline;
}

/* ── Home ── */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.category-card:hover, .course-card:hover {
    border-color: #bae6fd;
    box-shadow: var(--shadow-raised);
}

.category-card h3, .category-card h4 { margin: 0.5rem 0 0.25rem; font-size: 1.125rem; }

.category-card h3 a, .category-card h4 a {
    color: var(--color-text-primary);
    text-decoration: none;
}

.category-card p { margin: 0; }

.category-card .meta { margin-top: auto; padding-top: 0.75rem; }

.category-children {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Home page topic groups and the articles each topic suggests (#880). */
.topic-group + .topic-group { margin-top: 0.5rem; }

.topic-group-title {
    font-family: var(--font-subtitle);
    font-size: 1.125rem;
    color: var(--color-brand-dark);
    margin: 0 0 0.75rem;
}

.topic-group .category-grid { margin-bottom: 2rem; }

/* Home page role buttons under the search and the common tasks row (#883). */
.role-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 1.25rem;
}

.role-buttons-label { color: rgba(255, 255, 255, 0.92); font-weight: 600; }

.role-buttons ul { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }

.role-button {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.role-button:hover { background: rgba(255, 255, 255, 0.18); }

.role-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.task-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    list-style: none;
    margin: 0 0 2.5rem;
    padding: 0;
}

.task-link { display: block; margin-top: 0; padding: 0.9rem 1rem; font-weight: 600; text-decoration: none; }

.topic-top {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    font-size: 0.9375rem;
}

/* Above the card's stretched link, so each article opens itself. */
.topic-top a { position: relative; z-index: 1; }

.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #e0f2fe;
    color: var(--color-brand);
    flex-shrink: 0;
}

.home-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* ── Article lists ── */

.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-list li + li { border-top: 1px solid var(--color-border); }

.article-list a {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.75rem 0.5rem;
    text-decoration: none;
    border-radius: var(--radius);
}

.article-list a:hover { background: var(--color-surface-raised); }

.article-list-title {
    font-weight: 600;
    color: var(--color-link);
}

.article-list-summary {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
}

.category-section h2 { margin-bottom: 0.25rem; }

.category-section h2 a { text-decoration: none; color: var(--color-text-primary); }

/* ── Article ── */

.article-layout, .lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
    align-items: start;
}

.article-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.article-aside, .lesson-aside {
    position: sticky;
    top: calc(var(--app-header-height) + 1.5rem);
}

.toc ol, .chapters ol {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9375rem;
}

.toc li { margin: 0.125rem 0; }

.toc a {
    display: block;
    padding: 0.25rem 0.5rem;
    border-left: 2px solid var(--color-border);
    color: var(--color-text-secondary);
    text-decoration: none;
}

.toc a:hover {
    border-left-color: var(--color-brand-teal);
    color: var(--color-brand);
}

.toc .toc-level-3 a { padding-left: 1.25rem; }

.related .article-list a, .in-category .article-list a { padding: 0.5rem 0.25rem; }

.in-category-current {
    display: block;
    padding: 0.5rem 0.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.in-category-all { margin: 0.5rem 0 0; font-size: 0.9375rem; }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 1.25rem 0 0;
    margin: 1.5rem 0 0;
    border-top: 1px solid var(--color-border);
}

.tag-list a {
    display: inline-block;
    font-size: 0.8125rem;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
}

.tag-list a:hover { background: #e0f2fe; color: var(--color-brand); }

.feedback form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.feedback h2 { margin: 0; }

.feedback-buttons { display: flex; gap: 0.5rem; }

.feedback form.feedback-reason {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.feedback-reason fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.feedback-reason legend {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-choice {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.feedback-reason textarea { width: 100%; font: inherit; }

.feedback-thanks {
    font-weight: 600;
    color: var(--color-brand);
    margin: 0 0 0.25rem;
}

/* ── Prose (rendered TipTap content) ── */

.prose {
    font-size: 1rem;
    line-height: 1.7;
}

.prose > :first-child { margin-top: 0; }

.prose h2, .card .prose h2 { font-size: 1.375rem; margin-top: 2rem; padding-top: 0.25rem; }

.prose h3 { margin-top: 1.5rem; }

.prose h4 { margin-top: 1.25rem; }

.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure, .prose .table-wrap, .prose details, .prose .callout {
    margin: 0 0 1rem;
}

.prose li > p { margin: 0 0 0.375rem; }

.prose ul, .prose ol { padding-left: 1.5rem; }

.prose figure.image {
    margin: 1.25rem 0;
}

.prose figure.image img {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.prose figcaption {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.375rem;
}

.prose blockquote {
    border-left: 3px solid var(--color-brand-teal);
    padding: 0.25rem 1rem;
    color: var(--color-text-secondary);
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.prose pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

.prose pre code { background: none; padding: 0; color: inherit; }

.prose hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.prose .table-wrap { overflow-x: auto; }

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.prose th, .prose td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.prose th { background: var(--color-surface-raised); font-weight: 600; }

.prose th p, .prose td p { margin: 0; }

.callout {
    border: 1px solid;
    border-left-width: 4px;
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
}

.callout > :last-child { margin-bottom: 0; }

.callout-info { background: var(--color-info-bg); border-color: var(--color-info-border); }

.callout-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); }

.callout-tip { background: var(--color-tip-bg); border-color: var(--color-tip-border); }

.prose details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-raised);
}

.prose summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.prose .details-content { padding: 0 1rem 0.5rem; }

.prose .video, .prose .video-embed, .player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 1.25rem;
}

.prose video, .prose iframe, .player video, .player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.player .muted {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    margin: 0;
}

/* ── Courses and lessons ── */

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.course-card {
    position: relative;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.course-card + .course-card { margin-top: 0; }

.course-card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--color-surface-raised);
}

.course-card-body { padding: 1.25rem 1.5rem 1.5rem; }

.course-card h3 { margin-top: 0; }

.course-card h3 a { color: var(--color-text-primary); text-decoration: none; }

.course-card-kicker {
    margin: 0 0 0.25rem;
    color: var(--color-brand);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.course-card-description { color: var(--color-text-secondary); font-size: 0.9375rem; }

.course-card-description p { margin: 0 0 0.5rem; }

.course-header {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.course-header-image {
    width: 240px;
    border-radius: var(--radius);
    flex-shrink: 0;
}

/* Audience landing page (#586): a client's own page of paths, courses, guides and articles. */
.landing-header {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.landing-header h1 { margin-top: 0; }

.landing-header .lead:last-child { margin-bottom: 0; }

.landing-header-image {
    width: 200px;
    max-height: 160px;
    object-fit: contain;
    border-radius: var(--radius);
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .landing-header { flex-direction: column; align-items: flex-start; }
    .landing-header-image { width: 100%; max-width: 280px; }
}
.course-mini-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.course-mini-list a {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--radius);
    text-decoration: none;
}

.course-mini-list a:hover { background: var(--color-surface); }

.course-mini-list img { border-radius: 6px; object-fit: cover; }

.course-mini-list span { display: flex; flex-direction: column; }

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lesson-list li + li { border-top: 1px solid var(--color-border); }

.lesson-list a {
    display: flex;
    gap: 0.875rem;
    align-items: center;
    padding: 0.75rem 0.5rem;
    text-decoration: none;
    border-radius: var(--radius);
}

.lesson-list a:hover { background: var(--color-surface-raised); }

.lesson-list a > span:last-child { display: flex; flex-direction: column; }

.lesson-list a[aria-current="page"] {
    background: #e0f2fe;
    font-weight: 600;
    color: var(--color-brand);
}

.lesson-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e0f2fe;
    color: var(--color-brand);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Take lessons in order (#860). */
.lock-icon { vertical-align: -0.2em; flex-shrink: 0; }

.lesson-locked { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }

.lesson-list .lesson-locked-item { color: var(--color-muted, inherit); }

.lesson-list-compact a { padding: 0.5rem 0.25rem; font-size: 0.9375rem; }

.lesson-list-compact .lesson-number { width: 1.625rem; height: 1.625rem; font-size: 0.75rem; }

.chapters a {
    display: flex;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius);
    text-decoration: none;
}

.chapters a:hover { background: var(--color-surface-raised); }

.chapter-time {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    min-width: 3rem;
    padding-top: 0.15rem;
}

.lesson-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.lesson-nav .spacer { flex: 1; }

/* ── Not found ── */

.not-found .search-box-hero {
    margin: 1rem 0 1.5rem;
    box-shadow: none;
    border: 1px solid var(--color-border);
}

/* The sign-in page's code box and the request below it (#915), set apart like sections. */
.signin-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.signin-section h2 { margin-top: 0; }

/* ── Footer ── */

.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
}

.footer-inner {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 1.5rem max(1.5rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.footer-brand { display: flex; flex-direction: column; }

.footer-brand strong { color: var(--color-text-primary); font-family: var(--font-title); }

.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

.footer-links a { color: var(--color-text-secondary); text-decoration: none; }

.footer-links a:hover { color: var(--color-brand); text-decoration: underline; }

.footer-copy { margin: 0 0 0 auto; }

/* ── Blazor error UI ── */

#blazor-error-ui {
    background: #fef2f2;
    color: #991b1b;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem max(1.25rem, env(safe-area-inset-right)) calc(0.7rem + env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.4rem;
    background: none;
    border: 0;
    font-size: 1.25rem;
}

/* ── Responsive ── */

@media (max-width: 960px) {
    .article-layout, .lesson-layout, .home-columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-aside, .lesson-aside { position: static; }

    .course-header { flex-direction: column; align-items: flex-start; }

    .course-header-image { width: 100%; max-width: 360px; }
}

@media (max-width: 720px) {
    .top-bar-inner {
        flex-wrap: wrap;
        gap: 0.5rem 0.5rem;
        padding: calc(0.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
    }

    /* Row one: brand, language and account. Row two: search. Row three: the pages, scrolling sideways (#839). */
    .language-switcher { order: 1; margin-left: auto; }

    .account-signin, .account-menu { order: 2; }

    .language-current { display: none; }

    .account-signin { padding: 0.3rem 0.75rem; font-size: 0.875rem; }

    .top-bar-search {
        width: 100%;
        margin: 0;
        order: 3;
    }

    .top-bar-inner > .top-nav {
        order: 4;
        width: calc(100% + 1rem);
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -0.5rem;
        padding-bottom: 0.125rem;
        scrollbar-width: none;
    }

    .top-nav::-webkit-scrollbar { display: none; }

    .top-nav a { padding: 0.375rem 0.5rem; font-size: 0.875rem; }

    .hero { padding: 2.5rem 0 3rem; }

    .hero-inner { padding: 0 1rem; }

    .page { padding: 1.25rem 1rem 2rem; }

    .card { padding: 1.125rem; }

    .search-box-hero button { padding: 0.6rem 0.875rem; }

    .footer-copy { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* ── Search ── */

.page.narrow-wide { max-width: 880px; }

.search-header-body { flex: 1; }

.search-header .search-box-hero { max-width: none; }

.search-summary {
    color: var(--color-text-secondary);
    margin: 0 0 1rem;
}

.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-result + .search-result { margin-top: 1rem; }

.search-result h2 { margin: 0 0 0.25rem; font-size: 1.1875rem; }

.search-result h2 a { text-decoration: none; }

.search-result h2 a:hover { text-decoration: underline; }

.search-snippet {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.search-snippet mark {
    background: #fef08a;
    color: var(--color-text-primary);
    border-radius: 2px;
    padding: 0 0.1em;
}

.search-empty ul { padding-left: 1.25rem; }

/* ── Sign in (as DocMX Extract: brand panel beside a centred sign-in card) ── */

.login-shell {
    display: grid;
    grid-template-columns: minmax(360px, 1.1fr) minmax(420px, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-body);
    background: var(--color-surface-raised);
}

/* ── Brand panel ─────────────────────────────────────── */
.login-brand {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    color: #ffffff;
    background:
        radial-gradient(120% 90% at 0% 100%, rgba(14, 165, 198, 0.35) 0%, transparent 55%),
        linear-gradient(150deg, #041e3d 0%, #063565 45%, #074684 100%);
}

.login-brand-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    z-index: -1;
    animation: login-drift 18s ease-in-out infinite alternate;
}

.login-brand-glow--a {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -100px;
    background: radial-gradient(circle, #0ea5c6 0%, transparent 70%);
}

.login-brand-glow--b {
    width: 360px;
    height: 360px;
    bottom: -140px;
    left: 10%;
    background: radial-gradient(circle, #a0edf7 0%, transparent 70%);
    opacity: 0.3;
    animation-duration: 24s;
    animation-direction: alternate-reverse;
}

/* Faint engineering grid that fades out toward the edges. */
.login-brand-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 20%, transparent 75%);
}

@keyframes login-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-40px, 30px, 0) scale(1.12); }
}

.login-brand-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    height: 100%;
    max-width: 520px;
    padding: 3rem 3.5rem;
    box-sizing: border-box;
}

.login-brand-logo .brand-logo {
    width: 132px;
    height: auto;
}

.login-brand-eyebrow {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-brand-accent);
}

.login-brand-headline {
    margin: 0 0 2rem;
    font-family: var(--font-title);
    font-size: clamp(1.75rem, 2.6vw, 2.4rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.login-brand-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.login-brand-points li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.86);
}

.login-brand-icon {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 10px;
    color: var(--color-brand-accent);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.login-brand-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.login-brand-foot {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

/* ── Sign-in side ────────────────────────────────────── */
.login-main {
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(14, 165, 198, 0.08) 0%, transparent 70%),
        var(--color-surface-raised);
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2.25rem 2.5rem 2.5rem;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px -8px rgba(7, 70, 132, 0.18);
    animation: login-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Brand accent bar along the top edge of the card. */
.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, var(--color-brand) 0%, var(--color-brand-teal) 100%);
}

@keyframes login-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.login-title {
    margin: 0 0 0.4rem;
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
}


.login-sub {
    margin: 0 0 1.5rem;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.login-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
    border-color: var(--color-brand-teal);
    box-shadow: 0 0 0 3px rgba(14, 165, 198, 0.15);
}

/* Full-width gradient button, used for both the DocMX link and the admin submit. */
.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--color-brand) 0%, #0a5ea8 60%, var(--color-brand-teal) 140%);
    box-shadow: 0 6px 16px -6px rgba(7, 70, 132, 0.55);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.login-submit:hover {
    color: #ffffff;
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(7, 70, 132, 0.6);
}

.login-submit:focus-visible {
    outline: 3px solid var(--color-brand-accent);
    outline-offset: 2px;
}

.login-hint {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    text-align: center;
}

/* System admin sign-in, a secondary section under the DocMX button. */
.login-admin {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.login-admin summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
}

.login-admin summary::-webkit-details-marker { display: none; }
.login-admin summary:hover { color: var(--color-brand); }
.login-admin[open] summary { margin-bottom: 0.875rem; }

/* Narrow screens: the brand panel becomes a compact band above the card. */
@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .login-brand-inner {
        max-width: none;
        padding: 1.5rem;
        gap: 0;
    }

    .login-brand-copy,
    .login-brand-foot {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-brand-glow,
    .login-card {
        animation: none;
    }

    .login-submit {
        transition: none;
    }
}

.login-error svg { flex-shrink: 0; }

.login-back { text-align: center; font-size: 0.8125rem; margin: 1.25rem 0 0; }

/* ── Admin ── */

/* The admin bar spans the window, like docmxStatus, so the sidebar sits under the logo. */
.admin-top-bar { max-width: none; gap: 1rem; }

.view-site {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--radius);
    white-space: nowrap;
}

.view-site:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.admin-shell { display: flex; align-items: stretch; }

.admin-main { flex: 1 1 auto; min-width: 0; }

/* Sidebar (as docmxStatus, without its accordion or icon rail: every section stays open). */
.admin-sidebar {
    position: sticky;
    top: var(--app-header-height);
    align-self: flex-start;
    height: calc(100vh - var(--app-header-height));
    height: calc(100dvh - var(--app-header-height));
    width: 232px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 1.25rem 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-nav-section { display: flex; flex-direction: column; gap: 0.125rem; }

.admin-nav-label {
    font-family: var(--font-subtitle);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    padding: 0.25rem 0.75rem;
}

.admin-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.admin-nav-item:hover { background: var(--color-surface-raised); color: var(--color-text-primary); }

.admin-nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.admin-nav-item.active { background: rgba(7, 70, 132, 0.08); color: var(--color-brand); }

.admin-nav-item.active::before {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    background: var(--color-brand-teal);
    border-radius: 0 3px 3px 0;
}

.admin-nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Help admin is a desktop tool, so small screens get a scrolling strip above the page, not a drawer. */
@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }

    .admin-sidebar {
        position: static;
        align-self: stretch;
        height: auto;
        width: auto;
        flex-direction: row;
        gap: 0.25rem;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
        padding: 0.5rem 0.75rem;
    }

    .admin-nav-section { flex-direction: row; }

    .admin-nav-section + .admin-nav-section { border-left: 1px solid var(--color-border); padding-left: 0.25rem; }

    .admin-nav-label { display: none; }

    .admin-nav-item { gap: 0.5rem; padding: 0.4rem 0.625rem; }

    .admin-nav-item.active::before { display: none; }
}

.auth-pill .signout-btn { white-space: nowrap; }

.auth-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    padding: 0.25rem 0.375rem 0.25rem 0.625rem;
    font-size: 0.8125rem;
}

.auth-pill form { margin: 0; }

.auth-name { font-weight: 600; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.signout-btn {
    color: rgba(255, 255, 255, 0.9);
    background: none;
    border: 0;
    font: inherit;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.signout-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-grid > .card { margin-top: 0; }

.stat { display: flex; flex-direction: column; }

.stat-value { font-family: var(--font-title); font-size: 2rem; font-weight: 700; color: var(--color-brand); }

.stat-label { color: var(--color-text-secondary); font-size: 0.875rem; }

.inline-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }

/* Access links admin: addresses and code, and actions that sit side by side in a table row. */
.mono, .code-sample { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }
.code-sample { background: #f3f4f6; border-radius: var(--radius); padding: 0.75rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.row-actions { display: flex; gap: 0.75rem; justify-content: flex-end; white-space: nowrap; }
.link-button.danger { color: #b91c1c; }
.link-address { width: 100%; min-width: 18rem; padding: 0.375rem 0.5rem; border: 1px solid #d1d5db; border-radius: var(--radius); background: #f9fafb; }
.field-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; padding: 0; margin: 0 0 1rem; }
.field-list li { display: flex; gap: 0.5rem; align-items: center; }

.field { display: flex; flex-direction: column; gap: 0.25rem; }

.field label:not(.radio) { font-size: 0.8125rem; font-weight: 600; color: #374151; }

.field input:not([type=radio]):not([type=checkbox]), .field select, .data-table select {
    font: inherit;
    font-size: 0.9375rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    background: #fff;
    min-width: 12rem;
}

/* Wide admin tables scroll inside their wrapper on a phone, not the whole page. Positioned so the
   visually hidden labels in its cells are clipped by it too, rather than widening the page. */
.table-wrap { overflow-x: auto; position: relative; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

.data-table th, .data-table td { text-align: left; padding: 0.625rem 0.5rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }

.data-table th { font-size: 0.8125rem; color: var(--color-text-secondary); font-weight: 600; }

.data-table select { min-width: 8rem; }

.button-small { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }

/* Staff only: a jump from the public page to its editor (#369). */
.staff-edit { display: flex; justify-content: flex-end; margin: 0 0 0.75rem; }

.form-error { color: #991b1b; margin: 0.75rem 0 0; }

.form-status { color: #166534; margin: 0.75rem 0 0; }

/* ── Admin and editor ── */

.admin-header { justify-content: space-between; align-items: center; }

.admin-filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }

.admin-filters input, .admin-filters select, #redirect-filter {
    font: inherit;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    background: #fff;
}

.small { font-size: 0.8125rem; }

.banner { padding: 0.625rem 0.875rem; border-radius: var(--radius); margin: 0 0 1rem; }

.form-error.banner { background: #fef2f2; border: 1px solid #fecaca; }

.form-status.banner { background: #f0fdf4; border: 1px solid #bbf7d0; }

/* The outcome of an admin action stays in view under the top bar (#853). */
.admin-status {
    position: sticky;
    top: calc(var(--app-header-height) + 0.5rem);
    z-index: 30;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* The top bar wraps to two rows on a phone. */
@media (max-width: 720px) { .admin-status { top: 6.75rem; } }

.admin-status .admin-status-text { margin: 0; flex: 1 1 14rem; color: inherit; }

.admin-status.form-error { color: #991b1b; }

.admin-status.form-status { color: #166534; }

.admin-status .button { flex: none; }

.admin-status-dismiss::before { content: "\00d7"; }

.admin-status-dismiss {
    flex: none;
    margin-left: auto;
    background: none;
    border: 0;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.badge-live { background: #dcfce7; color: #166534; }

.badge-draft { background: #f1f5f9; color: #475569; }

.badge-changes { background: #fef3c7; color: #92400e; }

.badge-overdue { background: #fee2e2; color: #991b1b; }

.badge-internal { background: #ede9fe; color: #5b21b6; }

.badge-audience { background: #dbeafe; color: #1e40af; }

/* What a recipient link's audiences would miss (#558). */
.link-warnings { margin: 0.35rem 0 0; padding-left: 1.1rem; max-width: 28rem; }

.link-warnings li + li { margin-top: 0.25rem; }

.editor-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: sticky;
    top: var(--app-header-height);
    z-index: 20;
    background: var(--color-surface-raised);
    padding: 0.5rem 0;
}

.editor-status { display: flex; align-items: center; gap: 0.5rem; }

.editor-actions, .form-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.form-actions { margin-top: 1rem; }

.form-actions .spacer, .dialog-actions .spacer { flex: 1; }

.editor-layout, .admin-two-column, .revisions-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

.admin-two-column { grid-template-columns: minmax(0, 1fr) 380px; }

.revisions-layout { grid-template-columns: 320px minmax(0, 1fr); }

.editor-side .card + .card { margin-top: 1rem; }

.editor-side h2 { font-size: 1rem; }

.title-input {
    width: 100%;
    border: none;
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}

.summary-input {
    width: 100%;
    border: none;
    resize: vertical;
    font-family: var(--font-subtitle);
    font-size: 1.0625rem;
    color: var(--color-text-secondary);
    padding: 0.25rem 0;
}

.title-input:focus, .summary-input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--color-brand-teal); }

.char-count { text-align: right; margin: 0 0 0.75rem; }

.field { margin-bottom: 0.875rem; }

.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
    width: 100%;
    min-width: 0;
    font: inherit;
    font-size: 0.9375rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    background: #fff;
}

.field-label, fieldset.field legend { font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 0.25rem; display: block; }

fieldset.field { border: none; padding: 0; margin: 0 0 0.875rem; }

.radio { display: flex; gap: 0.5rem; align-items: center; font-size: 0.9375rem; margin: 0.25rem 0; }

/* About twenty sites and a few regions: the list scrolls rather than pushing the rest of the form down. */
.audience-picker-list { max-height: 14rem; overflow-y: auto; border: 1px solid #d1d5db; border-radius: var(--radius); padding: 0.25rem 0.625rem; background: #fff; }

.slug-input { display: flex; align-items: center; gap: 0.25rem; }

.slug-input span { font-size: 0.875rem; white-space: nowrap; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--color-link);
    cursor: pointer;
    text-align: left;
}

.link-button:hover { text-decoration: underline; }

/* Rich text editor */

/* TipTap's base editor rules. TipTap would inject these as an inline style element, which the
   Content Security Policy blocks, so the editor runs with injectCSS off and they live here. */
.ProseMirror {
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
    white-space: break-spaces;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0;
}
.ProseMirror [contenteditable="false"] { white-space: normal; }
.ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; }
.ProseMirror pre { white-space: pre-wrap; }
img.ProseMirror-separator {
    display: inline !important;
    border: none !important;
    margin: 0 !important;
    width: 0 !important;
    height: 0 !important;
}
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.ProseMirror-gapcursor::after {
    content: "";
    display: block;
    position: absolute;
    top: -2px;
    width: 20px;
    border-top: 1px solid black;
    animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink { to { visibility: hidden; } }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection * { caret-color: transparent; }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }

.rte {
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    background: #fff;
}

.rte:focus-within { border-color: var(--color-brand-teal); box-shadow: var(--focus-ring); }

.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0.375rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    border-radius: var(--radius) var(--radius) 0 0;
    position: sticky;
    top: calc(var(--app-header-height) + 3.25rem);
    z-index: 10;
}

.rte-group { display: flex; gap: 0.125rem; align-items: center; padding-right: 0.5rem; border-right: 1px solid var(--color-border); }

.rte-group:last-child, .rte-group-end { border-right: 0; }

.rte-group-end { margin-left: auto; }

.rte-button, .rte-select {
    font: inherit;
    font-size: 0.8125rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
}

.rte-select { border-color: #d1d5db; background: #fff; }

.rte-button:hover:not(:disabled) { background: #e2e8f0; }

.rte-button[aria-pressed="true"] { background: #dbeafe; border-color: #93c5fd; color: var(--color-brand); }

.rte-button:disabled { opacity: 0.4; cursor: default; }

.rte-bold { font-weight: 700; }

.rte-italic { font-style: italic; }

.rte-underline { text-decoration: underline; }

.rte-strike { text-decoration: line-through; }

.rte-status { margin: 0; padding: 0.375rem 0.75rem; font-size: 0.8125rem; background: #eff6ff; color: var(--color-brand); }

.rte-surface .ProseMirror {
    min-height: 420px;
    padding: 1rem 1.25rem;
    outline: none;
}

.rte-surface .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    float: left;
    height: 0;
    pointer-events: none;
}

.rte-surface .ProseMirror img { max-width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius); }

.rte-surface .ProseMirror img[data-missing-alt] { outline: 3px dashed #f59e0b; outline-offset: 2px; }

.rte-surface .ProseMirror .ProseMirror-selectednode { outline: 3px solid var(--color-brand-teal); outline-offset: 2px; }

.rte-surface .ProseMirror table { border-collapse: collapse; width: 100%; }

.rte-surface .ProseMirror th, .rte-surface .ProseMirror td { border: 1px solid var(--color-border); padding: 0.375rem 0.5rem; position: relative; }

.rte-surface .ProseMirror .selectedCell::after { content: ""; position: absolute; inset: 0; background: rgba(14, 165, 198, 0.15); pointer-events: none; }

.rte-surface .ProseMirror [data-type="details"] { display: flex; gap: 0.25rem; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 0.5rem; margin: 0 0 1rem; }

.rte-surface .ProseMirror [data-type="details"] > button { background: none; border: 0; cursor: pointer; }

.rte-surface .ProseMirror [data-type="details"] > div { flex: 1; }

.rte-surface .ProseMirror summary { font-weight: 600; }

.rte-surface .ProseMirror .video, .rte-surface .ProseMirror .video-embed { pointer-events: none; }

/* Dialogs */

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem;
}

.dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
    width: min(560px, 100%);
    max-height: 88vh;
    overflow: auto;
    padding: 1.5rem;
}

.dialog h2 { font-size: 1.25rem; }

.dialog-image { max-height: 180px; border-radius: var(--radius); border: 1px solid var(--color-border); margin-bottom: 0.75rem; }

.picker-list { list-style: none; padding: 0; margin: 0 0 1rem; max-height: 240px; overflow: auto; }

.picker-list button {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 6px;
    padding: 0.5rem;
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.picker-list button:hover { background: var(--color-surface-raised); }

/* Reorder lists */

.reorder-list { list-style: none; padding: 0; margin: 0; }

.reorder-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    background: #fff;
}

.reorder-item.dragging { opacity: 0.5; background: #e0f2fe; }

.drag-handle { cursor: grab; color: #94a3b8; font-size: 1.125rem; user-select: none; }

.reorder-body { flex: 1; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.reorder-buttons { display: flex; gap: 0.25rem; }

/* Revisions */

.revision-list { list-style: none; padding: 0; margin: 0; }

.revision {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    padding: 0.5rem 0.75rem;
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.revision:hover { background: var(--color-surface-raised); }

.revision.selected { border-left-color: var(--color-brand-teal); background: #e0f2fe; }

.revision-when { font-weight: 600; }

.diff-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.diff { list-style: none; padding: 0; margin: 0; font-size: 0.9375rem; }

.diff li { padding: 0.25rem 0.5rem; border-left: 3px solid transparent; }

.diff-added { background: #ecfdf5; border-left-color: #10b981 !important; }

.diff-removed { background: #fef2f2; border-left-color: #ef4444 !important; text-decoration: line-through; color: #7f1d1d; }

.diff-legend { padding: 0 0.375rem; border-radius: 4px; margin-left: 0.5rem; text-decoration: none; }

/* Preview, courses, lessons */

.preview-banner {
    background: #fef3c7;
    color: #78350f;
    text-align: center;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.preview-banner a { margin-left: 0.75rem; }

.course-edit-image { width: 100%; border-radius: var(--radius); margin-bottom: 0.5rem; }

.lesson-edit-video { width: 100%; border-radius: var(--radius); margin-top: 0.5rem; background: #0f172a; }

.chapter-row { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto; gap: 0.5rem; margin-bottom: 0.5rem; }

.chapter-row input { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid #d1d5db; border-radius: var(--radius); }

.quiz-question { border: 1px solid #e5e7eb; border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; }

.quiz-option-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }

.quiz-option-row input:not([type="checkbox"]), .quiz-question textarea, .quiz-question select { font: inherit; padding: 0.4rem 0.5rem; border: 1px solid #d1d5db; border-radius: var(--radius); }

@media (max-width: 960px) {
    .editor-layout, .admin-two-column, .revisions-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ── Translations (editor) ── */

.translation-list { list-style: none; margin: 0; padding: 0; }

.translation-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.translation-list li:last-child { border-bottom: 0; }

.translation-language { font-weight: 600; }

.translation-actions { margin-left: auto; display: flex; gap: 0.375rem; }

.translation-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.translation-layout > .card + .card { margin-top: 0; }

.translation-source { background: var(--color-surface-raised); }

.translation-title { font-size: 1.5rem; margin: 0.25rem 0 0.5rem; }

.translation-table td, .translation-table th { text-align: center; }

.translation-table .tr-item { text-align: left; }

.translation-table .tr-select { width: 2rem; }

.translation-table .tr-progress { white-space: nowrap; font-variant-numeric: tabular-nums; }

.translation-table tfoot th, .translation-table tfoot td { font-weight: 600; border-top: 2px solid var(--color-border); }

.translation-table .tr-row-selected { background: var(--color-surface-raised); }

.translation-table .badge { margin-left: 0.375rem; }

.translation-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }

.translation-toolbar p { margin: 0; }

.translation-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.translation-key .tr-cell { margin: 0 0.25rem 0 0.75rem; vertical-align: middle; }

.translation-key .tr-cell:first-child { margin-left: 0; }

.tr-cell {
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 999px;
    border: 2px solid transparent;
}

.tr-current { background: #16a34a; }

.tr-stale { background: #f59e0b; }

.tr-missing { background: transparent; border-color: #94a3b8; }

.tr-edited { box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px #7c3aed; }

@media (max-width: 900px) {
    .translation-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ── Lesson transcript and chapter highlighting ── */

.transcript {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin: 0 0 1.25rem;
}

.transcript summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.transcript-lines {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem 0.75rem;
    max-height: 420px;
    overflow-y: auto;
}

.transcript-lines a {
    display: flex;
    gap: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius);
    color: var(--color-text-primary);
    text-decoration: none;
    line-height: 1.5;
}

.transcript-lines a:hover { background: var(--color-surface-raised); }

.transcript-lines a[data-active] { background: #e0f2fe; }

.chapters a[aria-current="true"] { background: #e0f2fe; font-weight: 600; }

/* ── Ask DocMX ── */

.ask { display: flex; flex-direction: column; gap: 0.75rem; }

.ask-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.ask-full .ask-messages { min-height: 320px; max-height: 60vh; }

.ask-compact .ask-messages { height: min(420px, 55vh); padding-right: 0.25rem; }

.ask-message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    max-width: 92%;
    line-height: 1.55;
    font-size: 0.9375rem;
}

.ask-message p { margin: 0 0 0.5rem; }

.ask-message p:last-child { margin-bottom: 0; }

.ask-message ol, .ask-message ul { margin: 0 0 0.5rem; padding-left: 1.25rem; }

.ask-user {
    align-self: flex-end;
    background: var(--color-brand);
    color: #fff;
    white-space: pre-wrap;
}

.ask-assistant { align-self: flex-start; background: var(--color-surface-raised); border: 1px solid var(--color-border); }

.ask-typing { color: var(--color-text-secondary); font-style: italic; }

.ask-error { color: #991b1b; }

.ask-cite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    margin: 0 0.1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--color-brand);
    text-decoration: none;
    vertical-align: super;
}

.ask-cite:hover { background: var(--color-brand); color: #fff; }

.ask-sources {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0 0 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
}

.ask-support { font-size: 0.875rem; margin: 0.5rem 0 0; }

.ask-feedback { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.625rem; }

.ask-suggestions { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.ask-suggestions button {
    font: inherit;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    color: var(--color-brand);
}

.ask-suggestions button:hover { border-color: var(--color-brand-teal); }

.ask-form { display: flex; gap: 0.5rem; align-items: flex-end; }

.ask-form textarea {
    flex: 1;
    font: inherit;
    resize: none;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
}

.ask-form textarea:focus { outline: none; border-color: var(--color-brand-teal); box-shadow: var(--focus-ring); }

.ask-disclaimer { margin: 0; }

.ask-widget {
    position: fixed;
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 150;
}

.ask-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--color-brand);
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.125rem;
    box-shadow: var(--shadow-raised);
    cursor: pointer;
}

.ask-launcher:hover { background: var(--color-brand-dark); }

.ask-panel {
    position: absolute;
    right: 0;
    bottom: 3.75rem;
    width: min(420px, calc(100vw - 2rem));
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
    padding: 1rem;
}

.ask-panel-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }

.ask-panel-header h2 { margin: 0; font-size: 1.0625rem; flex: 1; }

.ask-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--color-text-secondary); }

@media (max-width: 720px) {
    .ask-widget { right: max(0.75rem, env(safe-area-inset-right)); bottom: max(0.75rem, env(safe-area-inset-bottom)); }

    .ask-launcher span { display: none; }
}

.nowrap { white-space: nowrap; }

.log-answer { font-size: 0.8125rem; color: var(--color-text-secondary); max-width: 40rem; }

/* ── Editor AI helpers ── */

.ai-helper-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.dialog-wide { width: min(860px, 100%); }

.ai-preview {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 50vh;
    overflow: auto;
    margin-bottom: 1rem;
}

.ai-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }

.ai-compare h3 { font-size: 0.875rem; color: var(--color-text-secondary); }

.ai-text { white-space: pre-wrap; background: var(--color-surface-raised); border-radius: var(--radius); padding: 0.75rem; margin: 0; }

.ai-suggestion-list dt { font-weight: 600; font-size: 0.875rem; color: var(--color-text-secondary); margin-top: 0.75rem; }

.ai-suggestion-list dd { margin: 0.25rem 0 0; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.tag-button {
    font: inherit;
    font-size: 0.8125rem;
    padding: 0.125rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
}

.tag-button[aria-pressed="true"] { background: #dcfce7; border-color: #86efac; }

@media (max-width: 720px) {
    .ai-compare { grid-template-columns: 1fr; }
}

/* ── Learning: quizzes for learners (personal course links) ── */
.quiz { margin-top: 1.5rem; }
.quiz-questions, .quiz-results { padding-left: 1.25rem; }
.quiz-questions > li, .quiz-results > li { margin-bottom: 1.25rem; }
.quiz fieldset { border: 0; padding: 0; margin: 0; }
.quiz-prompt { font-weight: 600; margin: 0 0 0.5rem; }
/* A fieldset's legend is not in the list item's own flow, so the list marker lined up with the first answer (#650).
   The question list numbers its legends with a counter instead, which keeps each fieldset (and its grouping for
   screen readers) intact. */
.quiz-questions { list-style: none; padding-left: 0; counter-reset: quiz-question; }
.quiz-questions > li { counter-increment: quiz-question; }
.quiz-questions legend.quiz-prompt { padding: 0; }
.quiz-questions legend.quiz-prompt::before { content: counter(quiz-question) ". "; }
.quiz-prompt .muted { font-weight: 400; margin-left: 0.4em; }
.quiz-choice { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.35rem 0; }
.quiz-choice input { margin-top: 0.3rem; }
.quiz-score { padding: 0.75rem 1rem; border-radius: var(--radius); font-weight: 600; }
.quiz-passed { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.quiz-failed { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.quiz-results .quiz-right { border-left: 3px solid #10b981; padding-left: 0.75rem; }
.quiz-results .quiz-wrong { border-left: 3px solid #f59e0b; padding-left: 0.75rem; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.quiz-source { font-size: 0.9rem; }
.quiz-review { margin-top: 1rem; }
.course-finish { margin-top: 1.5rem; }

/* Mark as read and Finish (#603): a card under an article, plain inside a guide step. */
.item-done { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.5rem; }
.item-done form { margin: 0; }
.item-done-status { margin: 0; }
.guide-step .item-done { margin-top: 1.25rem; padding: 0; border: 0; box-shadow: none; background: none; }
.learner-link, .card h3 { margin-top: 1.5rem; }

.admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; }
.admin-form-grid input { width: 100%; font: inherit; padding: 0.4rem 0.5rem; border: 1px solid #d1d5db; border-radius: var(--radius); }

/* Admin article tree */

.tree-actions { display: flex; align-items: center; gap: 1rem; padding: 0 0 0.75rem; flex-wrap: wrap; }

.tree-actions > .muted { margin-right: auto; }

.article-tree .group-row th { background: var(--color-surface-raised); font-size: 0.9375rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }

.group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 0;
    padding: 0.125rem 0;
    font: inherit;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.group-toggle .muted { font-weight: 400; }

.group-chevron {
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex: none;
}

.group-toggle[aria-expanded="true"] .group-chevron { transform: rotate(45deg); }

.article-tree .indent-1 { padding-left: 1.75rem; }
.article-tree .indent-2 { padding-left: 3rem; }
.article-tree .indent-3 { padding-left: 4.25rem; }
.article-tree .indent-4 { padding-left: 5.5rem; }

@media (prefers-reduced-motion: reduce) {
    .group-chevron { transition: none; }
}

/* Fixed columns, so opening a category does not shift the others. */
.article-tree { table-layout: fixed; }
.article-tree .col-status { width: 40%; }
.article-tree .col-updated { width: 8rem; }

/* Lessons that read like an article (#207) */
/* Text at reading width; pictures (screenshots are dense) use the whole card. */
.lesson-text .prose > :not(figure) { max-width: 72ch; }
.lesson-practise { margin-top: 1.5rem; }
.lesson-practise h2 { font-size: 1.05rem; margin: 0 0 0.375rem; }
.lesson-practise .button { margin-top: 0.25rem; }
.lesson-downloads { margin-top: 1.5rem; }
.lesson-downloads h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.lesson-downloads ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.375rem; }
.lesson-downloads li { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }

/* Image zoom (#208) */
.zoom-trigger { display: block; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; max-width: 100%; border-radius: var(--radius); }
.zoom-trigger:focus-visible { outline: 3px solid var(--color-focus, #2563eb); outline-offset: 3px; }
.zoom-trigger img { display: block; }
.zoom-dialog { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
.zoom-dialog::backdrop { background: rgb(15 23 42 / 0.82); }
.zoom-image { display: block; max-width: 96vw; max-height: 88vh; width: auto; height: auto; border-radius: var(--radius); background: #fff; }
.zoom-close { display: block; margin: 0 0 0.5rem auto; padding: 0.375rem 0.875rem; border: 0; border-radius: var(--radius); background: #fff; color: #0f172a; font: inherit; font-weight: 600; cursor: pointer; }

/* ── Guides (#118) ── */

.guide-products {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin: 0 0 0.5rem;
}

.guide-product-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 1.1rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: var(--font-subtitle);
    font-weight: 600;
    text-decoration: none;
}

.guide-product-link:hover { border-color: var(--color-brand); color: var(--color-brand); }

.guide-group { margin-top: 2.5rem; scroll-margin-top: calc(var(--app-header-height) + 1rem); }

.guide-group-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.guide-group-header h2 { margin: 0; font-size: 1.5rem; }

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    position: relative;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.guide-card + .guide-card { margin-top: 0; }

.guide-card:hover { border-color: #bae6fd; box-shadow: var(--shadow-raised); }

.guide-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #e0f5fa;
}

.guide-card-image-empty {
    display: grid;
    place-items: center;
    color: #0a7d97;
}

.guide-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    padding: 1.1rem 1.25rem 1.35rem;
}

.guide-card-body .meta { margin: 0; }

.guide-card-body h3 { margin: 0; font-size: 1.1875rem; line-height: 1.3; }

.guide-card-body h3 a { color: var(--color-text-primary); text-decoration: none; }

.guide-card-summary { margin: 0; color: var(--color-text-secondary); font-size: 0.9375rem; }

.guide-card-more {
    margin-top: auto;
    padding-top: 0.5rem;
    font-family: var(--font-subtitle);
    font-weight: 600;
    color: var(--color-link);
}

.guide-card-more::after { content: " \2192"; }

.guide-eyebrow {
    margin: 0 0 0.5rem;
    font-family: var(--font-subtitle);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0a7d97;
}

.guide-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem 3rem;
    padding: 2rem;
}

.guide-hero-text { flex: 1 1 420px; min-width: 0; }

.guide-hero-text h1 { margin: 0; font-size: 2.25rem; line-height: 1.15; }

.guide-hero-text .lead { margin-top: 0.875rem; }

.guide-hero-image {
    flex: 1 1 360px;
    min-width: 0;
    max-width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background: #e0f5fa;
}

.guide-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    margin: 1.5rem 0 0;
}

.guide-facts dt { font-size: 0.8125rem; color: var(--color-text-secondary); }

.guide-facts dd { margin: 0.15rem 0 0; font-family: var(--font-title); font-weight: 500; font-size: 1.0625rem; }

.guide-start { margin-top: 1.75rem; min-height: 3rem; padding: 0 1.6rem; font-size: 1rem; }

.guide-start::after { content: " \2192"; }

/* A reader's place (#138): Continue beside Start again, and opened steps ticked. */
.guide-continue { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }

.guide-continue .button-secondary { margin-top: 1.75rem; min-height: 3rem; }

.guide-continue-note { margin: 0.5rem 0 0; }

.lesson-number.guide-step-tick { background: #dcfce7; color: #166534; }

.guide-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.guide-layout > .card + .card { margin-top: 0; }

.guide-covers { flex: 999 1 520px; min-width: 0; }

.guide-aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }

.guide-aside .card + .card { margin-top: 0; }

.guide-aside ul { margin: 0.75rem 0 0; padding-left: 1.25rem; }

.guide-aside li + li { margin-top: 0.5rem; }

.guide-outcomes { list-style: none; padding-left: 0 !important; }

.guide-outcomes li { position: relative; padding-left: 1.75rem; }

.guide-outcomes li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: #0a7d97;
    font-weight: 700;
}

.guide-step-list a { align-items: flex-start; }

.guide-step-list a > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }

.guide-step-time { flex: none; white-space: nowrap; }

.guide-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin: 0 0 1.5rem;
}

.guide-progress-title { font-family: var(--font-title); font-weight: 500; font-size: 1.0625rem; margin-right: auto; }

.guide-progress label { font-family: var(--font-subtitle); color: var(--color-text-secondary); }

.guide-progress progress {
    width: 14rem;
    max-width: 100%;
    height: 0.5rem;
    border: 0;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
    appearance: none;
}

.guide-progress progress::-webkit-progress-bar { background: var(--color-border); border-radius: 999px; }

.guide-progress progress::-webkit-progress-value { background: var(--color-brand-teal); border-radius: 999px; }

.guide-progress progress::-moz-progress-bar { background: var(--color-brand-teal); border-radius: 999px; }

.guide-step-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

.guide-step-layout > .card + .card { margin-top: 0; }

.guide-step-nav { flex: 1 1 240px; min-width: 0; max-width: 320px; padding: 0.75rem; }

.guide-step { flex: 999 1 520px; min-width: 0; padding: 2rem 2.25rem; }

.guide-step h1 { margin: 0; font-size: 2rem; line-height: 1.2; }

.guide-step .lead { margin-top: 0.75rem; }

.guide-step h1 + .prose { margin-top: 1.25rem; }

.guide-step-source { margin-top: 1.5rem; }

.guide-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.guide-pager .button { min-height: 3rem; white-space: normal; text-align: center; }

@media (max-width: 720px) {
    .guide-hero, .guide-step { padding: 1.25rem; }
    .guide-hero-text h1 { font-size: 1.75rem; }
    .guide-step-nav { max-width: none; }
    .guide-progress progress { width: 100%; }
}

/* Guide editor (#136) */
.input-narrow { max-width: 8rem; }
.guide-step-edit { flex: 1; display: grid; gap: 0.5rem; min-width: 0; }
.guide-step-edit-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.guide-step-edit-head .link-button { margin-left: auto; }
.guide-step-edit .field { margin: 0; }
.guide-step-find { margin-top: 1rem; }
.guide-step-matches { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.375rem; }
.guide-step-matches li { display: flex; gap: 0.5rem; align-items: center; padding: 0.375rem 0.5rem; border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius); }
.guide-step-matches li > span:first-child { flex: 1; }

/* ── Insights (admin) ── */
.card-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.card-heading h2 { margin: 0; }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.pre-line { white-space: pre-line; }

.course-due { margin: 0.5rem 0 0; position: relative; z-index: 1; }

.learner-reminders { margin-top: 2rem; max-width: 40rem; }

/* Learning paths and certificates (#224) */
.course-section + .course-section { margin-top: 2.5rem; }

.course-section h2 { margin-bottom: 1rem; }

.course-path { margin: 0.25rem 0 0.75rem; }

.path-course-status { font-weight: 600; }

.admin-path-courses { margin: 0.5rem 0 1rem; padding-left: 1.5rem; }

.admin-path-courses li { margin-bottom: 0.25rem; }
.admin-path > p > .button { margin-left: 0.75rem; }
.admin-path-audiences { margin: 0.5rem 0 1rem; }

.quiz-image { margin: 0.5rem 0 0.75rem; }

.quiz-image img { max-width: 100%; height: auto; border: 1px solid var(--color-border); border-radius: var(--radius); }

.quiz-edit-image { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.certificate {
    max-width: 52rem;
    margin: 1rem auto;
    padding: 3rem 2.5rem;
    text-align: center;
    border: 3px double var(--color-brand);
}

.certificate-kicker {
    margin: 0 0 1.5rem;
    color: var(--color-brand);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.certificate-line { margin: 0.5rem 0; color: var(--color-text-secondary); }

.certificate-name { margin: 0.25rem 0 1rem; font-size: 2rem; font-weight: 700; }

.certificate-title { margin: 0.25rem 0 1.5rem; font-size: 1.75rem; color: var(--color-brand); }

.certificate-facts { display: flex; justify-content: center; gap: 2.5rem; margin: 0 0 1.5rem; }

.certificate-facts dt { color: var(--color-text-secondary); font-size: 0.8125rem; }

.certificate-facts dd { margin: 0.25rem 0 0; font-weight: 600; }

.certificate-courses { margin: 0 auto 1.5rem; border-collapse: collapse; text-align: left; }

.certificate-courses caption { margin-bottom: 0.5rem; font-weight: 600; }

.certificate-courses th,
.certificate-courses td { padding: 0.375rem 0.75rem; border-bottom: 1px solid var(--color-border); }

.certificate-issuer { margin: 1.5rem 0 0; font-weight: 700; color: var(--color-brand); }

.certificate-issuer .brand-logo { width: 9rem; height: auto; margin: 0 auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.certificate-issuer .brand-logo path[fill="#fff"] { fill: var(--color-brand); }

/* A level badge (#753): the level's colour, a guilloche pattern, a framed border and an emblem. */
.certificate-badge { --badge: var(--color-brand); --badge-soft: #e0ecf8; position: relative; overflow: hidden; border: 0; padding: 2.5rem 2.5rem 3rem; background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--badge) 12%, transparent), transparent 60%),
        repeating-radial-gradient(circle at 0% 100%, transparent 0 14px, color-mix(in srgb, var(--badge) 7%, transparent) 14px 15px),
        repeating-radial-gradient(circle at 100% 100%, transparent 0 14px, color-mix(in srgb, var(--badge) 7%, transparent) 14px 15px),
        var(--color-surface);
    box-shadow: inset 0 0 0 6px var(--badge), inset 0 0 0 9px var(--color-surface), inset 0 0 0 10px color-mix(in srgb, var(--badge) 55%, transparent), var(--shadow-raised);
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.certificate-badge.level-practitioner { --badge: #15803d; }
.certificate-badge.level-advanced { --badge: #b45309; }
.certificate-badge.level-champion { --badge: #6d28d9; }
.certificate-badge .certificate-kicker,
.certificate-badge .certificate-title,
.certificate-badge .certificate-issuer { color: var(--badge); }
.certificate-badge .certificate-title { display: inline-block; margin-top: 0.5rem; padding: 0.375rem 2.5rem; color: #fff; background: var(--badge);
    clip-path: polygon(0 0, 100% 0, calc(100% - 1rem) 50%, 100% 100%, 0 100%, 1rem 50%); }
.certificate-badge .certificate-issuer { font-size: 1.125rem; }
.badge-emblem { display: block; width: 8.5rem; height: auto; margin: 0 auto 0.75rem; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15)); }
.badge-emblem-rosette { fill: var(--badge); }
.badge-emblem-tail { fill: color-mix(in srgb, var(--badge) 75%, #000); }
.badge-emblem-ring { fill: none; stroke: #fff; stroke-width: 2; stroke-dasharray: 2 4; }
.badge-emblem-face { fill: #fff; }
.badge-emblem-tier { fill: #e2e8f0; }
.badge-emblem-tier-held { fill: var(--badge); }

@media print {
    .top-bar,
    .site-footer,
    .ask-widget,
    .skip-link,
    .breadcrumbs,
    .certificate-print-hint,
    .certificate-share { display: none !important; }

    .certificate { margin: 0 auto; box-shadow: none; }
}

/* ── Code blocks: copy button, syntax colours and HTTP method badges (#469) ── */

.code-block { position: relative; margin: 0 0 1rem; }
.code-block > pre { margin: 0; padding-right: 4.5rem; }

.code-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid #475569;
    border-radius: 4px;
    background: #1e293b;
    color: #e2e8f0;
    font: inherit;
    font-size: 0.75rem;
    line-height: 1.4;
    cursor: pointer;
}
.code-copy:hover { background: #334155; }
.code-copy:focus-visible { outline: 3px solid var(--color-brand-accent); outline-offset: 2px; }
.code-copy.is-copied { color: #86efac; border-color: #86efac; }

/* Colours on the dark code background (#0f172a), all above 4.5:1. */
.prose pre .tok-key { color: #7dd3fc; }
.prose pre .tok-string { color: #86efac; }
.prose pre .tok-number { color: #fdba74; }
.prose pre .tok-keyword { color: #f0abfc; }
.prose pre .tok-punct { color: #94a3b8; }
.prose pre .tok-comment { color: #94a3b8; font-style: italic; }
.prose pre .tok-method { color: #fcd34d; font-weight: 700; }
.prose pre .tok-path { color: #e2e8f0; }
.prose pre .tok-header { color: #7dd3fc; }
.prose pre .tok-flag { color: #fcd34d; }
.prose pre .tok-variable { color: #fdba74; }

.http-method {
    display: inline-block;
    margin-right: 0.4em;
    padding: 0.05em 0.45em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.5;
    vertical-align: 0.1em;
    color: #fff;
}
.http-get { background: #0f766e; }
.http-post { background: #1d4ed8; }
.http-put { background: #b45309; }
.http-patch { background: #7e22ce; }
.http-delete { background: #b91c1c; }
.toc .http-method { font-size: 0.7em; }

/* Submission comments (#561): the review queue and the contributor's page. */
.submission-comments { list-style: none; margin: 0 0 1rem; padding: 0; }
.submission-comments li { border-left: 3px solid var(--color-border); padding: 0.25rem 0 0.25rem 0.75rem; margin-bottom: 0.75rem; }
.submission-comments p { margin: 0; }
.submission-comment-text { white-space: pre-wrap; }

/* A new API token (#562): long, so it wraps instead of widening the page. */
.token-value { white-space: pre-wrap; word-break: break-all; background: var(--color-surface-muted, #f1f5f9); padding: 0.75rem; border-radius: 6px; }

/* Admin: the landing page item list on the Audiences page (#586). */
.landing-editor { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem; }

.admin-landing-items { margin: 0 0 1rem; padding-left: 1.25rem; }

.admin-landing-items li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; padding: 0.375rem 0; border-bottom: 1px solid var(--color-border); }

.admin-landing-item-actions { display: flex; gap: 0.375rem; }

/* Admin: the learning plan item list (#605), the landing page list plus Required, a note and warnings. */
.admin-landing-item-actions .radio { margin: 0 0.25rem 0 0; }

.admin-plan-items .admin-plan-item-note { flex: 1 1 100%; }

.plan-item-warning { display: block; color: #991b1b; }

/* Admin: a plan's progress table (#606). States are words with a symbol; the colour only backs them up. */
.plan-progress-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; margin: 0 0 1rem; padding: 0; }

.plan-progress th[scope="row"] { font-weight: 600; white-space: nowrap; }

.plan-progress abbr { text-decoration: none; cursor: help; }

.plan-progress .plan-cell { white-space: nowrap; }

.plan-cell-done { color: #166534; }

.plan-cell-hidden { color: #991b1b; font-style: italic; }

.plan-due-overdue { color: #991b1b; font-weight: 600; }

/* My learning (#604): a learner's plans as panels of ordered items, then the landing page cards. */
.plan-panel + .plan-panel { margin-top: 1.25rem; }

.plan-panel-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem; }

.plan-panel-header h3 { margin: 0; }

.plan-panel-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; color: var(--color-text-secondary); }

.plan-items { list-style: none; margin: 1rem 0 0; padding: 0; }

.plan-item { display: flex; gap: 0.75rem; padding: 0.625rem 0; border-top: 1px solid var(--color-border); }

.plan-item-mark { flex-shrink: 0; width: 1.25rem; text-align: center; font-weight: 700; color: var(--color-text-secondary); }

.plan-state-done .plan-item-mark { color: #166534; }

.plan-state-started .plan-item-mark { color: var(--color-brand-teal); }

.plan-item-body { min-width: 0; }

.plan-item-body p { margin: 0; }

.plan-item-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }

.plan-item-kind { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary); }

.plan-item-optional { font-size: 0.8125rem; font-style: italic; color: var(--color-text-secondary); }

.plan-item-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.875rem; color: var(--color-text-secondary); }

.plan-item-note { font-size: 0.875rem; margin-top: 0.25rem; }

.my-learning .course-section { margin-top: 2rem; }

.my-learning-more { margin-top: 2rem; }

/* Admin quiz catalogue (#620) */
.quiz-catalogue-missing {
    margin-top: 0.75rem;
}

/* Supervisor learner pages (#610): the audience checkboxes are a plain fieldset, and the link actions sit apart. */
fieldset.audience-picker { border: 0; padding: 0; margin: 0 0 0.875rem; min-width: 0; }
fieldset.audience-picker legend { padding: 0; margin-bottom: 0.25rem; }
.manage-link-actions form + form { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.manage-link-actions .radio { display: block; margin-bottom: 0.5rem; }

/* Supervisor progress (#612): each plan on a learner's page stands apart, and quiz attempts are a compact list. */
.manage-plan-progress + .manage-plan-progress { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.manage-plan-progress h3 { margin: 0 0 0.25rem; }
.manage-attempts { margin: 0.125rem 0 0.5rem; padding-left: 1.125rem; }

/* ── Course levels and the pyramid (#742) ── */

.level-badge { background: var(--color-info-bg); color: var(--color-brand); border: 1px solid var(--color-info-border); }
.level-practitioner { background: #ecfdf5; color: #166534; border-color: #34d399; }
.level-advanced { background: #fffbeb; color: #92400e; border-color: #fbbf24; }
.level-champion { background: #f5f3ff; color: #5b21b6; border-color: #a78bfa; }
.course-level { margin: 0.25rem 0 0.75rem; display: flex; gap: 0.5rem; align-items: center; }
.course-take-first { margin: 1rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--color-info-border); background: var(--color-info-bg); border-radius: var(--radius); }
.course-take-first p { margin: 0 0 0.25rem; }
.course-take-first ul { margin: 0; padding-left: 1.25rem; }
/* Each level is a full-width row, from the top level down; the badge heads the row (#770). */
.course-pyramid { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.pyramid-heading { display: flex; gap: 0.75rem; align-items: center; margin: 0 0 0.625rem; font-size: 1rem; }
.pyramid-heading .badge { font-size: 0.875rem; }
.course-card-done { margin-left: 0.5rem; }

/* Compact course cards on /courses (#770), My learning (#776) and landing pages (#780): thumbnail beside the text, so a screen shows many courses. */
.course-grid-compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 0.75rem; }
.course-grid-compact .course-card { flex-direction: row; align-items: stretch; padding: 0; }
.course-grid-compact .course-card-image { width: 128px; flex-shrink: 0; aspect-ratio: 4 / 3; align-self: flex-start; margin: 0.75rem 0 0.75rem 0.75rem; border-radius: var(--radius); }
.course-grid-compact .course-card-body { padding: 0.75rem 1rem; min-width: 0; }
.course-grid-compact .course-card h3 { font-size: 1rem; margin: 0 0 0.25rem; }
.course-grid-compact .course-card-description { font-size: 0.875rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.course-grid-compact .course-card-description p { margin: 0; display: inline; }
.course-grid-compact .course-card-description p + p::before { content: " "; }
.course-grid-compact .course-card .meta { margin: 0.375rem 0 0; font-size: 0.8125rem; }
.course-grid-compact .course-card-kicker { font-size: 0.6875rem; }
.course-grid-compact .course-due { margin: 0.375rem 0 0; }
@media (max-width: 480px) { .course-grid-compact .course-card-image { width: 96px; } }

/* ── Level badges (#744) ── */

.badge-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.earned-badge { margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.earned-badge .meta { flex-basis: 100%; }

/* ── The team by level, for supervisors (#746) ── */

.team-level-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.team-level-summary .card { margin: 0; }
.team-level-summary h2 { font-size: 1.125rem; margin: 0 0 0.75rem; }
.team-level-counts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }

/* ── Share links and the verify page (#745) ── */

.certificate-share { max-width: 52rem; margin: 1.5rem auto; }
.share-link { width: 100%; font-family: var(--font-mono); font-size: 0.875rem; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.share-list li { margin: 0; display: grid; gap: 0.5rem; }
.verify-result { max-width: 44rem; margin: 2rem auto; text-align: center; }
.verify-state { margin: 0 0 0.5rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.verify-valid { border-top: 6px solid #15803d; }
.verify-valid .verify-state { color: #15803d; }
.verify-lapsed { border-top: 6px solid #b45309; }
.verify-lapsed .verify-state { color: #b45309; }

/* Signed-in home page (#881): a shorter banner, Continue and the reader's own Recently viewed list. */
.hero-compact { padding: 2rem 0 2.25rem; }

.shelf-section { margin-bottom: 2rem; }

.continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.continue-card {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--color-text-primary);
    text-decoration: none;
}

.continue-card:hover { border-color: #bae6fd; box-shadow: var(--shadow-raised); }

.continue-kind {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-link);
}

.continue-context { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--color-text-secondary); }

.continue-title { font-family: var(--font-subtitle); font-weight: 600; font-size: 1.125rem; line-height: 1.3; }

.continue-card progress {
    width: 100%;
    height: 6px;
    appearance: none;
    border: 0;
    border-radius: 3px;
    background: var(--color-border);
    overflow: hidden;
}

.continue-card progress::-webkit-progress-bar { background: var(--color-border); }
.continue-card progress::-webkit-progress-value { background: var(--color-brand-teal); }
.continue-card progress::-moz-progress-bar { background: var(--color-brand-teal); }

.shelf-panel { margin: 0 0 2.5rem; }

.shelf-panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    min-height: 44px;
}

.shelf-panel-header h2 { margin: 0; font-size: 1.25rem; }

.shelf-actions { display: flex; gap: 0.25rem; }

.shelf-actions .link-button { min-height: 44px; padding: 0 0.5rem; }

.recent-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }

.recent-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-top: 1px solid var(--color-border);
}

.recent-kind {
    flex: 0 0 4.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    color: #475569;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 0.25rem 0.375rem;
}

.recent-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.recent-text a { font-weight: 600; }

.shelf-privacy { margin-top: 0.75rem; }

/* Recently viewed and Saved side by side when there is room (#882). */
.shelf-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
    gap: 0 1.5rem;
    align-items: start;
}

.shelf-columns > .card + .card { margin-top: 0; }

/* Save on an item's page, and the star in lists (#882). */
.title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.title-row h1 { margin-right: auto; }

.save-form { flex: none; margin: 0; }

.save-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    padding: 0 0.875rem;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-brand);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    cursor: pointer;
}

.save-button:hover { border-color: var(--color-brand); }

.save-button:focus-visible { outline: 3px solid var(--color-brand-teal); outline-offset: 2px; }

.save-button.is-saved { color: #b45309; border-color: #fcd34d; background: #fffbeb; }

.save-compact .save-button { min-width: 44px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--color-text-secondary); }

.save-compact .save-button.is-saved { color: #b45309; }

/* ── Touch screens (#908): 44px tap targets, and 16px inputs so iOS does not zoom on focus ── */

@media (pointer: coarse), (max-width: 720px) {
    .brand, .top-nav a, .language-switcher summary, .account-signin, .account-signout, .link-button,
    .search-box button, .button, .ask-suggestions button {
        min-height: 44px;
    }

    .brand, .top-nav a, .language-switcher summary, .account-signin, .link-button {
        display: inline-flex;
        align-items: center;
    }

    .language-switcher summary { min-width: 44px; justify-content: center; }

    .account-signin { justify-content: center; }

    input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"]),
    select,
    textarea {
        font-size: 1rem;
        min-height: 44px;
    }

    .search-box-compact input { font-size: 1rem; }

    /* The form field rules are more specific than the ones above, so repeat the size here. */
    .field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea, .data-table select, .login-form input {
        font-size: 1rem;
        min-height: 44px;
    }

    .breadcrumbs a, .footer-links a, .chapters a, .guide-step-list a, .toc a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .chapters a, .guide-step-list a, .lesson-list a { display: flex; min-height: 44px; }

    .breadcrumbs ol { align-items: center; }

    .lesson-locked a { display: inline-flex; align-items: center; min-height: 44px; }

    .tag-list a { display: inline-flex; align-items: center; min-height: 44px; }

    .account-menu summary { min-height: 44px; min-width: 44px; justify-content: center; }

    /* Boxes and dots stay small to look right, but get a larger hit area (WCAG 2.5.8 asks for at least 24px). */
    input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; }
}

/* Quiz question results (#927) */
.quiz-difficulty-flagged { margin-bottom: 1.5rem; }
.quiz-difficulty-course { margin-top: 0.75rem; }
.quiz-difficulty-flag td { font-weight: 600; }

/* ── Sign-in by email link ── */
.login-shell--single { grid-template-columns: 1fr; }

.login-sent {
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.login-sent p { margin: 0; }

.login-sent .login-sent-title { font-weight: 600; margin-bottom: 0.25rem; }
