/* Design tokens (--bg, --text, --primary, dark-mode overrides, etc.) now
   live in shared-tokens.css, loaded before this file — see each HTML
   page's <head>. Todo loads the same file cross-origin. */

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-brand,
.topbar-nav,
.topbar-actions {
    display: flex;
    align-items: center;
}

.topbar-brand {
    gap: 16px;
}

.topbar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.topbar nav a {
    margin-left: 4px;
    padding: 6px 14px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 9999px;
    transition: background 0.15s, color 0.15s;
}

.topbar nav a:hover {
    background: var(--primary-tint, #fff1ee);
    color: var(--primary);
    text-decoration: none;
}

.topbar nav a.active {
    background: var(--primary);
    color: #fff;
}

.app-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.app-switcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 9999px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.app-switcher-btn:hover {
    background: var(--primary-tint, #fff1ee);
    color: var(--text);
}

.app-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: row;
    gap: 4px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* An author-stylesheet `display` rule on this element would otherwise beat
   the UA stylesheet's [hidden] { display: none } regardless of specificity,
   since author styles always win over UA styles — so the `hidden` attribute
   needs its own explicit override here to actually hide the menu. */
.app-switcher-menu[hidden] {
    display: none;
}

.topbar .app-switcher-menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 64px;
    margin-left: 0;
    padding: 8px 4px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.topbar .app-switcher-menu a img {
    border-radius: 6px;
}

.topbar .app-switcher-menu a:hover {
    background: var(--surface-alt);
    text-decoration: none;
}

.topbar .app-switcher-menu a.current {
    background: var(--primary-tint, #fff1ee);
    color: var(--primary);
    font-weight: 700;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px;
}

.container.narrow {
    max-width: 420px;
}

.container.wide {
    max-width: 1200px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
p.muted, span.muted { color: var(--text-muted); font-size: 0.9rem; }

/* ---- Author byline ("Written by ___" — see authorBylineHtml() in common.js) ---- */
.author-byline {
    display: flex; align-items: center; gap: 8px;
    margin: -10px 0 16px; color: var(--text-muted); font-size: 0.85rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-alt);
    border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 0.9em;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    margin-top: 12px;
}

input[type=text], input[type=email], input[type=password], input[type=url], textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

/* Base look for any plain <select> not already covered by a more specific
   rule (.list-toolbar/.collaborator-actions/.invite-form/.share-setting-row
   select below) — e.g. the workspace pickers on the editor pages and in
   promptWorkspacePicker(), which previously fell back to unstyled browser
   default appearance. No width:100%, unlike the text-input rule above:
   these sit inline next to a button in a .btn-row rather than stacked full
   width like a labeled field. */
select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

textarea { resize: vertical; }

input.invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; min-height: 1em; }

.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.toggle-visibility {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 4px 8px; font-size: 0.75rem; font-weight: 600;
}
.toggle-visibility:hover { background: none; color: var(--text); }

button, .btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .btn:hover { background: var(--primary-hover); text-decoration: none; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.secondary, .btn.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
button.secondary:hover, .btn.secondary:hover { background: var(--bg); }

button.danger, .btn.danger { background: var(--danger); }
button.danger:hover, .btn.danger:hover { background: var(--danger-hover); }

.btn-row { display: flex; gap: 8px; margin-top: 16px; align-items: center; }

.error-msg {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 12px;
}

.success-msg {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 12px;
}

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs button {
    background: none; color: var(--text-muted); border: none; border-bottom: 2px solid transparent;
    border-radius: 0; padding: 8px 4px; margin-right: 16px; font-weight: 600;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button:hover { background: none; text-decoration: none; }

.guide-list { display: flex; flex-direction: column; gap: 10px; }
.guide-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 18px;
}
.guide-row .title { font-weight: 600; }
.guide-row .meta {
    color: var(--text-muted); font-size: 0.85rem; margin-top: 4px;
    display: flex; flex-wrap: wrap; row-gap: 4px;
}
.guide-row .meta .meta-item:not(:first-child)::before { content: '\00b7'; margin: 0 8px; }
.guide-row .meta strong { color: var(--text); font-weight: 600; }
/* Related-content rows (relatedItemsHtml in common.js) have no secondary
   meta line under the title, just this "Guide"/"Article" type tag — pin it
   to the row's right edge and keep it from wrapping or getting squeezed by
   a long title, independent of the row's own justify-content. */
.guide-row .related-type-label {
    margin: 0 0 0 16px; flex-shrink: 0; white-space: nowrap;
}
.guide-row[draggable=true] { cursor: grab; }
.guide-row.dragging { opacity: 0.4; }
.badge {
    display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
    background: var(--badge-bg); color: var(--primary); margin-left: 8px;
}
.badge.recording { background: var(--badge-recording-bg); color: var(--badge-recording-text); }
.badge.shared { background: var(--badge-shared-bg); color: var(--badge-shared-text); }
.badge.views { background: var(--badge-views-bg); color: var(--badge-views-text); }
.badge.feedback { background: var(--badge-feedback-bg); color: var(--badge-feedback-text); }
/* Help centre landing page (kb_list's `badge`) — reuse the "shared"/"views"
   token pairs rather than adding new ones, same as .badge.role-owner does. */
.badge.new { background: var(--badge-shared-bg); color: var(--badge-shared-text); }
.badge.updated { background: var(--badge-views-bg); color: var(--badge-views-text); }
.badge.stalled { background: var(--error-bg); color: var(--danger); }

/* ---- Breadcrumbs ---- */
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { margin: 0 6px; }
.breadcrumbs .current { color: var(--text); font-weight: 600; }

/* ---- List toolbar (search / filter / sort) ---- */
.list-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px;
}
.list-toolbar input[type=text] { max-width: 260px; }
.list-toolbar select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
    background: var(--surface); color: var(--text); font-family: inherit;
}
.list-toolbar .spacer { flex: 1; }
.list-toolbar .result-count { color: var(--text-muted); font-size: 0.85rem; }

/* ---- Bulk selection ---- */
.select-row { display: flex; align-items: center; gap: 12px; }
.select-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.select-checkbox-spacer { display: inline-block; width: 16px; flex-shrink: 0; }
.bulk-bar {
    display: none; align-items: center; gap: 10px; background: var(--badge-bg); border: 1px solid var(--primary);
    border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: 0.9rem;
}
.bulk-bar.visible { display: flex; }
.bulk-bar .spacer { flex: 1; }
.select-all-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text-muted); font-size: 0.85rem; }
.select-all-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

.empty-state { text-align: center; color: var(--text-muted); padding: 48px 20px; }
.empty-state h2 { font-size: 1.15rem; margin: 0 0 8px; color: var(--text); }
.empty-state .onboarding-steps {
    text-align: left; max-width: 340px; margin: 16px auto; padding-left: 20px; color: var(--text);
}
.empty-state .onboarding-steps li { margin-bottom: 6px; }

.step-card {
    position: relative;
    display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 34px; cursor: grab;
}
.step-card.dragging { opacity: 0.4; }

/* "Insert step below" affordance: a "+" circle centered on a divider line
   straddling the gap between this card and the next one. */
.insert-step-row {
    position: absolute; left: 0; right: 0; bottom: -17px;
    display: flex; align-items: center; justify-content: center;
    z-index: 3;
}
.insert-step-row::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--border);
}
.insert-step-btn {
    position: relative; width: 26px; height: 26px; padding: 0; border-radius: 50%;
    border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1;
    cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.insert-step-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.1); }
/* Unscoped (not `.step-card .screenshot-wrap`) on purpose: the lightbox
   re-parents this element out of .step-card into .lightbox-frame, and it
   must keep establishing its own containing block wherever it ends up, or
   its absolutely-positioned children (marker, annotation SVG/blur/handles)
   size themselves against the wrong ancestor instead of the image.
   `align-self: flex-start` opts out of .step-card's flex stretch so the wrap
   shrink-wraps to the image's actual rendered box (a no-op outside a flex
   parent, e.g. inside .lightbox-frame, so it's safe to leave unscoped too). */
.screenshot-wrap { position: relative; align-self: flex-start; max-width: 100%; }
.step-card img {
    /* width/height both auto (not width:100% + object-fit:contain) so the
       image's CSS layout box always equals its visible pixels — with a
       forced width and only max-height capped, a narrower-than-wide
       screenshot gets letterboxed by object-fit inside a box that stays
       full width, and percentage-positioned overlays (marker, annotations)
       end up placed relative to that full-width box instead of the visibly
       narrower image, drifting off from where they should be. */
    display: block; width: auto; height: auto; max-width: 100%; max-height: 560px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--surface-alt);
}
.click-marker {
    position: absolute; width: 16px; height: 16px; margin-left: -11px; margin-top: -11px;
    border-radius: 50%; background: #dc2626; border: 3px solid #fff;
    box-shadow: 0 0 0 2px #dc2626, 0 2px 6px rgba(0,0,0,0.35); pointer-events: none;
}
.click-marker::after {
    content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid #dc2626;
    animation: marker-ping 1.6s ease-out infinite;
}
.click-marker.editable { pointer-events: auto; cursor: grab; touch-action: none; }
.click-marker.editable.dragging-marker { cursor: grabbing; }
.click-marker.editable.dragging-marker::after { animation: none; opacity: 0; }
@keyframes marker-ping {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}
.step-card .step-body { flex: 1; min-width: 0; }
.step-card .step-num {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
    background: var(--primary); color: #fff; border-radius: 50%; font-size: 0.75rem; font-weight: 700;
    margin-right: 8px;
}
.step-card .step-url { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 8px; word-break: break-all; }
.step-card .step-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step-card .step-status { font-size: 0.8rem; }

/* Read-only rendering of a step's rich-text description (preview/share pages).
   Mirrors .article-body below — the step description editor (guide-editor.js)
   offers the same header/size/blockquote formats as the article editor. */
.step-card .step-description { color: var(--text); font-size: 0.95rem; line-height: 1.5; }
.step-card .step-description p { margin: 0 0 0.6em; }
.step-card .step-description p:last-child { margin-bottom: 0; }
.step-card .step-description h1, .step-card .step-description h2, .step-card .step-description h3 { margin: 0.8em 0 0.4em; }
.step-card .step-description h1:first-child, .step-card .step-description h2:first-child, .step-card .step-description h3:first-child { margin-top: 0; }
.step-card .step-description blockquote {
    margin: 0 0 0.6em; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--text-muted);
}
.step-card .step-description .ql-size-small { font-size: 0.75em; }
.step-card .step-description .ql-size-large { font-size: 1.5em; }
.step-card .step-description .ql-size-huge { font-size: 2.5em; }
.step-card .step-description img { max-width: 100%; height: auto; border-radius: 4px; }

/* ---- Quill rich-text editor (step description, editor only) ---- */
.description-editor-wrap { margin-top: 4px; }
.description-editor-wrap .ql-toolbar.ql-snow {
    border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0; background: var(--surface-alt);
}
.description-editor-wrap .ql-container.ql-snow {
    border: 1px solid var(--border); border-radius: 0 0 6px 6px; background: var(--surface);
    font-family: inherit; font-size: 0.95rem;
}
.description-editor-wrap .ql-editor { color: var(--text); min-height: 80px; }
.description-editor-wrap .ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }
.description-editor-wrap .ql-snow .ql-stroke { stroke: var(--text-muted); }
.description-editor-wrap .ql-snow .ql-fill { fill: var(--text-muted); }
.description-editor-wrap .ql-snow .ql-picker { color: var(--text-muted); }
/* The editHtml toolbar button's icon is plain text ("</>"), not an SVG like
   Quill's built-in icons — without explicit sizing/weight it renders as
   near-invisible thin default-size text next to the stroke-based icons. */
.description-editor-wrap .ql-toolbar .ql-editHtml {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700;
    font-size: 13px; color: var(--text-muted);
}
.description-editor-wrap .ql-snow .ql-picker-options { background: var(--surface); border: 1px solid var(--border); }
.description-editor-wrap .ql-snow.ql-toolbar button:hover .ql-stroke { stroke: var(--primary); }
.description-editor-wrap .ql-snow.ql-toolbar button:hover .ql-fill { fill: var(--primary); }
.description-editor-wrap .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary); }

/* ---- Callout box (tip/note/warning) ----
   Shared Quill format (registered once in common.js) used by both the
   article body and step description editors, and rendered identically in
   their read-only views (.article-body / .step-description) since it's
   just a plain div with this class in the saved HTML. */
.ql-callout {
    background: var(--callout-bg);
    border: 1px solid var(--callout-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 0 0 0.8em;
}
.ql-callout:last-child { margin-bottom: 0; }
/* Consecutive callout blocks (a user can format more than one paragraph)
   collapse into a single seamless box instead of stacking separate ones. */
.ql-callout + .ql-callout {
    margin-top: -1px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.ql-callout:has(+ .ql-callout) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    margin-bottom: 0;
}

/* ---- Button chip (decorative "this refers to a UI button" marker) ----
   Shared Quill format (registered once in common.js) used by both the
   article body and step description editors, and rendered identically in
   their read-only views since it's just a plain span with this class in
   the saved HTML. Purely visual — not a link, not clickable — so no
   pointer cursor or hover state. */
.ql-button-chip {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 1px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9em;
    line-height: 1.6;
}

/* ---- Persistent zoom/crop view ----
   The wrap gets a definite width (viewport-relative, matching the lightbox's
   own responsive pattern below) so its `aspect-ratio` — set from JS once the
   image's natural size is known, see applyZoomFrame in common.js — has
   something to compute a height from; the image itself is absolutely
   positioned and scaled via plain percentages (also set from JS) so the
   saved crop region fills the wrap exactly. */
.screenshot-wrap.screenshot-zoomed { width: min(92vw, 640px); overflow: hidden; }
.lightbox-frame .screenshot-wrap.screenshot-zoomed { width: min(92vw, 1100px); }
.screenshot-wrap.screenshot-zoomed img { position: absolute; top: 0; left: 0; border-radius: 0; }
.zoom-badge {
    position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.55); color: #fff;
    font-size: 0.7rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; z-index: 2;
    pointer-events: none;
}

/* ---- Crop picker (lightbox "Zoom View" mode) ---- */
.crop-overlay { position: absolute; inset: 0; cursor: crosshair; z-index: 6; touch-action: none; }
.crop-select-box {
    position: absolute; border: 2px dashed #fff; background: rgba(37, 99, 235, 0.25);
    box-shadow: 0 0 0 2000px rgba(0,0,0,0.4); pointer-events: none;
}
.crop-controls { margin-top: 12px; text-align: center; }
.crop-controls .btn-row { justify-content: center; }

.token-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
    text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .row-actions { text-align: right; white-space: nowrap; }
.data-table .row-actions button {
    background: none; border: none; color: var(--text-muted); font-size: 0.85rem;
    font-weight: 500; padding: 4px 8px; cursor: pointer;
}
.data-table .row-actions button:hover { color: var(--primary); background: none; }
.data-table .row-actions button.danger-link:hover { color: var(--danger); }
.status-active { color: var(--success-text); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status-active .status-dot { width: 8px; height: 8px; background: var(--success-text); box-shadow: none; }
.status-inactive { color: var(--text-muted); }

/* ---- Extension connection status ---- */
.extension-status { display: flex; align-items: center; gap: 12px; }
.status-dot {
    width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted);
}
.extension-status.status-ok .status-dot { background: var(--success-text); box-shadow: 0 0 0 4px var(--success-bg); }
.extension-status.status-idle .status-dot,
.extension-status.status-warn .status-dot { background: var(--badge-recording-text); box-shadow: 0 0 0 4px var(--badge-recording-bg); }
.extension-status.status-none .status-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--error-bg); }
.token-plaintext {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--token-bg); border: 1px solid var(--token-border);
    padding: 10px 12px; border-radius: 6px; word-break: break-all; font-size: 0.9rem; margin-top: 8px;
    color: var(--text);
}

.share-box { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.share-box input { flex: 1; }

/* ---- Collaborators ---- */
.collaborator-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.collaborator-row:last-child { border-bottom: none; }
.collaborator-identity { display: flex; align-items: center; gap: 10px; }
.collaborator-row .collaborator-name { font-weight: 600; }
.collaborator-row .collaborator-email { color: var(--text-muted); font-size: 0.85rem; }
.collaborator-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.collaborator-actions select {
    padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font-family: inherit; font-size: 0.85rem;
}
.badge.role-owner { background: var(--badge-shared-bg); color: var(--badge-shared-text); }
.badge.role-editor { background: var(--badge-bg); color: var(--primary); }
.badge.role-viewer { background: var(--surface-alt); color: var(--text-muted); }
.invite-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.invite-form input[type=email] { flex: 1; min-width: 180px; }
.invite-form select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font-family: inherit; font-size: 0.9rem;
}
.role-banner {
    display: flex; align-items: center; gap: 8px; background: var(--badge-bg); color: var(--primary);
    border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; font-weight: 600;
}

.share-meta { margin-top: 10px; font-size: 0.85rem; }
.share-meta .sep { margin: 0 6px; }
.share-settings {
    display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--border);
}
.share-setting-row { display: flex; align-items: center; gap: 8px; }
.share-setting-row label { flex-shrink: 0; width: 90px; margin: 0; font-size: 0.85rem; font-weight: 600; }
.share-setting-row select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 0.9rem; }
.share-setting-row input[type=text] { max-width: 220px; }

.loading { color: var(--text-muted); padding: 20px; text-align: center; }

/* .skeleton/.skeleton-row/@keyframes skeleton-shimmer and the toast/
   confirm-modal component styles now live in shared-ui.css (loaded before
   this file), except this one screen-specific tweak: */

/* ---- Copy feedback ---- */
button.copied, button.copied:hover { background: var(--success-text); }

/* ---- Lightbox (click-to-zoom) ---- */
.lightbox-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 1002;
    display: flex; align-items: center; justify-content: center; padding: 32px;
    opacity: 0; transition: opacity 0.2s ease;
}
.lightbox-overlay.show { opacity: 1; }
.lightbox-frame { position: relative; max-width: 100%; max-height: 100%; line-height: 0; }
.lightbox-frame img {
    display: block; max-width: 100%; max-height: calc(100vh - 64px); object-fit: contain;
    border-radius: 6px; background: var(--surface-alt);
}
.lightbox-close {
    position: absolute; top: -16px; right: -16px; width: 32px; height: 32px; border-radius: 50%;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
    padding: 0; cursor: pointer;
}
.lightbox-close:hover { background: var(--bg); }
.zoom-btn {
    position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 6px;
    background: rgba(0,0,0,0.55); color: #fff; border: none; font-size: 0.95rem; line-height: 1;
    display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.zoom-btn:hover { background: rgba(0,0,0,0.75); }

/* The lightbox re-parents the real .screenshot-wrap (and, in the editor,
   its annotation toolbar) rather than cloning it — see openScreenshotLightbox
   in common.js — so marker drag / annotation drawing keep working at the
   larger size. These overrides keep the wrap's box exactly matching the
   image's rendered box (shrink-wrapped), so percentage-based marker/
   annotation coordinates still line up correctly. */
.lightbox-frame .screenshot-wrap {
    display: inline-block;
    max-width: min(92vw, 1100px);
}
.lightbox-frame .screenshot-wrap img {
    display: block; width: auto; height: auto;
    max-width: min(92vw, 1100px); max-height: calc(100vh - 140px);
}
.lightbox-frame .annotation-toolbar { margin-top: 12px; justify-content: center; }
.screenshot-wrap.lightbox-active .zoom-btn { display: none; }
.screenshot-wrap.zoomable { cursor: zoom-in; }

/* ---- Annotation overlay (rect/arrow/blur) ---- */
.annotation-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.annotation-shape {
    stroke: var(--danger); stroke-width: 2; fill: none; vector-effect: non-scaling-stroke;
}
.annotation-arrowhead-fill { fill: var(--danger); }
.annotation-blur {
    position: absolute; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(8px);
    background: rgba(0,0,0,0.12); border-radius: 2px; pointer-events: none;
}
.annotation-delete {
    position: absolute; width: 18px; height: 18px; margin-top: -24px; margin-left: -2px;
    border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid var(--surface);
    font-size: 0.7rem; line-height: 1; display: flex; align-items: center; justify-content: center;
    padding: 0; cursor: pointer; z-index: 3;
}
.annotation-delete:hover { background: var(--danger-hover); }

/* Move (rect/blur body drag) and resize/endpoint handles. */
.annotation-move {
    position: absolute; cursor: move; pointer-events: auto; z-index: 1;
}
.annotation-handle {
    position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px;
    border-radius: 50%; background: var(--surface); border: 2px solid var(--danger);
    pointer-events: auto; z-index: 2; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.annotation-handle[data-corner="x1y1"], .annotation-handle[data-corner="x2y2"] { cursor: nwse-resize; }
.annotation-handle[data-corner="x2y1"], .annotation-handle[data-corner="x1y2"] { cursor: nesw-resize; }
.annotation-handle[data-corner="start"], .annotation-handle[data-corner="end"] { cursor: crosshair; }

/* Tool-active cursor feedback on the screenshot itself. */
.screenshot-wrap[data-tool="rect"], .screenshot-wrap[data-tool="arrow"], .screenshot-wrap[data-tool="blur"] {
    cursor: crosshair;
}

/* ---- Add-marker hint (click-to-place) ---- */
.add-marker-hint {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.25); color: #fff; font-size: 0.85rem; font-weight: 600;
    opacity: 0; transition: opacity 0.15s ease; cursor: crosshair; border-radius: 6px;
}
.step-card .screenshot-wrap:hover .add-marker-hint { opacity: 1; }

/* ---- Editor: step title, annotation toolbar, reorder buttons ---- */
.step-title-input {
    font-weight: 600; border: 1px solid transparent; background: transparent; padding: 2px 4px;
    border-radius: 4px; margin: 0;
}
.step-title-input:hover, .step-title-input:focus { border-color: var(--border); background: var(--surface); }
.step-heading-row { display: flex; align-items: center; gap: 4px; }
.step-heading-row .step-title-input { flex: 1; font-size: 1rem; }

.annotation-toolbar { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tool-btn {
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    padding: 5px 10px; font-size: 0.8rem; font-weight: 600; border-radius: 6px; cursor: pointer;
}
.tool-btn:hover { background: var(--bg); }
.tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.icon-btn { padding: 8px 10px; line-height: 1; }
.icon-btn:disabled { opacity: 0.35; }

.preview-banner {
    background: var(--badge-bg); border: 1px solid var(--primary); color: var(--text);
    padding: 10px 14px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 16px;
}
.preview-banner a { font-weight: 600; margin-left: 6px; }

/* ---- Password-protected share prompt ---- */
.password-prompt { max-width: 360px; margin: 48px auto; text-align: center; }
.password-prompt .card { text-align: left; }

/* ---- Split view / follow-along (preview + share pages) ---- */
.viewer-layout.split-view-active {
    display: grid;
    grid-template-columns: minmax(360px, 620px) 1fr;
    align-items: start;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}
.split-view-active .container {
    max-width: none;
    margin: 0;
    padding: 32px 0;
}
.split-view-pane {
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.split-view-pane[hidden] { display: none; }
.split-view-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    font-size: 0.78rem; color: var(--text-muted);
}
.split-view-open-link { font-weight: 600; white-space: nowrap; }
.split-view-open-link.disabled { pointer-events: none; opacity: 0.5; }
.split-view-frame { flex: 1; width: 100%; border: none; background: #fff; }

/* No breakpoint convention exists elsewhere in this file; 860px sits just
   under .container's own 900px max-width, so the two-column grid never
   squeezes the step list below its comfortable reading width before
   falling back to a stacked layout. */
@media (max-width: 860px) {
    .viewer-layout.split-view-active { grid-template-columns: 1fr; padding: 0; }
    .split-view-active .container { padding: 32px 20px; }
    .split-view-active .split-view-pane {
        position: static; height: 60vh; margin: 0 20px 32px;
    }
}

/* ---- Viewer feedback (share page widget + owner-side summary/list) ---- */
#feedback-up.selected, #feedback-down.selected {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
#feedback-comment-area { margin-top: 12px; }
#feedback-comment { width: 100%; resize: vertical; }
.feedback-entry {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 0; border-top: 1px solid var(--border);
}
.feedback-entry:first-child { border-top: none; }

/* ---- Knowledge base articles: rendered body + guide-embed cards ---- */
.article-summary {
    color: var(--text-muted); font-size: 1.05rem; line-height: 1.5; margin: 0 0 20px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.article-body { color: var(--text); font-size: 0.98rem; line-height: 1.6; }
.article-body p { margin: 0 0 0.8em; }
.article-body p:last-child { margin-bottom: 0; }
.article-body h1, .article-body h2, .article-body h3 { margin: 1.2em 0 0.5em; }
.article-body h1:first-child, .article-body h2:first-child, .article-body h3:first-child { margin-top: 0; }
.article-body blockquote {
    margin: 0 0 0.8em; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--text-muted);
}
/* Quill's built-in text-size format (toolbar in article-editor.html) —
   same em values Quill's own quill.snow.css uses, since this page doesn't
   load that stylesheet (only the editor needs its picker-dropdown CSS). */
.article-body .ql-size-small { font-size: 0.75em; }
.article-body .ql-size-large { font-size: 1.5em; }
.article-body .ql-size-huge { font-size: 2.5em; }
.article-body img { max-width: 100%; height: auto; border-radius: 4px; }
.description-editor-wrap #body-editor .ql-editor { min-height: 240px; }

/* Read-only table rendering (public article viewer, list previews) — the
   editor gets its own richer table styling from quill-table-better.css,
   loaded only on article-editor.html since it's only needed for the
   editing toolbar/menus, not for displaying already-saved table markup. */
.article-body table { border-collapse: collapse; width: 100%; margin: 0.6em 0; }
.article-body table td, .article-body table th {
    border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top;
}
.article-body table th { background: var(--surface-alt); font-weight: 600; }

.guide-embed-card, .article-embed-card {
    display: flex; align-items: center; gap: 10px; margin: 0.6em 0; padding: 10px 90px 10px 14px;
    background: var(--badge-bg); border: 1px solid var(--primary); border-radius: var(--radius);
    font-size: 0.9rem; user-select: none;
    position: relative;
}
.guide-embed-icon, .article-embed-icon { flex-shrink: 0; color: var(--primary); }
.guide-embed-title, .article-embed-title { font-weight: 600; color: var(--text); }
/* Positioned absolutely (relative to the card) rather than pushed right via
   margin-left:auto on a flex sibling — Quill re-wraps an embed's contents in
   extra `<span contenteditable="false">` layers on repeated edit/save
   cycles (visible in already-saved article bodies), which nests this
   element too deep to still be a direct flex child of .article-embed-card
   by the time it's rendered. Absolute positioning finds its nearest
   positioned ancestor (the card itself) regardless of how many such
   wrapper spans sit in between, so it keeps landing at the right edge
   either way. padding-right on the card reserves room so a long title
   never runs underneath it. */
.guide-embed-meta, .article-embed-meta {
    color: var(--text-muted); font-size: 0.8rem; white-space: nowrap;
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
}
.guide-embed-card.guide-embed-unavailable, .article-embed-card.article-embed-unavailable {
    background: var(--surface-alt); border-color: var(--border); color: var(--text-muted); font-style: italic;
}
.guide-embed-card.guide-embed-clickable, .article-embed-card.article-embed-clickable { cursor: pointer; }
.guide-embed-card.guide-embed-clickable:hover, .article-embed-card.article-embed-clickable:hover { background: var(--bg); }

/* ---- Cap recording embeds ----
   .cap-embed-card is the saved/editor form (and the fallback if a viewer
   doesn't hydrate); viewers swap it for .cap-embed-frame (see
   hydrateCapEmbeds in common.js). */
.cap-embed-card {
    display: flex; align-items: center; gap: 10px; margin: 0.6em 0; padding: 10px 70px 10px 14px;
    background: var(--badge-bg); border: 1px solid var(--primary); border-radius: var(--radius);
    font-size: 0.9rem; user-select: none; position: relative;
}
.cap-embed-icon { flex-shrink: 0; }
.cap-embed-title { font-weight: 600; color: var(--text); }
.cap-embed-meta {
    color: var(--text-muted); font-size: 0.8rem; white-space: nowrap;
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
}
.cap-embed-frame {
    position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 0.8em 0;
    border-radius: var(--radius); overflow: hidden; background: #000;
}
.cap-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cap-embed-print-link { display: none; }
/* Guide step whose screenshot is replaced by a Cap video (editor: the
   screenshot and its tools stay in the DOM, just hidden). */
.cap-step-video { margin: 0; }
.cap-hero-video { margin: 0.4em 0 1.2em; }
#cap-hero-card .cap-hero-video { margin: 0.4em 0 0; max-width: 560px; }
.step-card [data-role="cap-video"]:empty { display: none; }
.step-card.has-cap-video .screenshot-wrap,
.step-card.has-cap-video .annotation-toolbar,
.step-card.has-cap-video [data-action="set-zoom"] { display: none; }
@media print {
    .cap-embed-frame { display: none; }
    .cap-embed-print-link { display: block; margin: 0.6em 0; }
}

/* ---- Process chart (Mermaid) embeds ----
   .mermaid-embed-card is the saved/editor form (PNG snapshot or source,
   plus an editor-only label); a live, page-themed SVG is painted over it in
   a shadow root (see paintMermaidCard in common.js). */
.mermaid-embed-card {
    margin: 0.8em 0; padding: 10px; border: 1px dashed var(--primary); border-radius: var(--radius);
    background: var(--surface); text-align: center; user-select: none; cursor: pointer; position: relative;
}
.mermaid-embed-card:hover { background: var(--bg); }
/* The snapshot is always light (it's also the PDF image), so in dark mode
   it sits on a white mat rather than clashing with the dark surface. */
.mermaid-embed-image { max-width: 100%; height: auto; display: block; margin: 0 auto; background: #fff; border-radius: 6px; }
.mermaid-embed-source {
    text-align: left; margin: 0; padding: 10px; font-size: 0.8rem; white-space: pre-wrap;
    background: var(--surface-alt); border-radius: 6px; color: var(--text);
}
.mermaid-embed-label { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--text-muted); }
/* Read-only pages: no editing affordances. The live SVG is painted into a
   shadow root inside the card (paintMermaidCard in common.js); a card that
   couldn't render keeps showing its light snapshot. */
.mermaid-embed-readonly { cursor: default; border-style: solid; border-color: var(--border); padding: 16px; overflow-x: auto; }
.mermaid-embed-readonly:hover { background: var(--surface); }
.mermaid-embed-readonly .mermaid-embed-label { display: none; }
.mermaid-embed-failed { border-style: solid; border-color: var(--border); }
.mermaid-modal { width: min(960px, 94vw); max-width: none; }
.mermaid-modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mermaid-modal-body textarea {
    min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; resize: vertical;
}
.mermaid-modal-preview {
    min-height: 320px; max-height: 60vh; overflow: auto; border: 1px solid var(--border);
    border-radius: 6px; background: var(--surface); padding: 10px; display: flex; align-items: center; justify-content: center;
}
.mermaid-modal-preview svg { max-width: 100%; height: auto; }
@media (max-width: 700px) { .mermaid-modal-body { grid-template-columns: 1fr; } }
@media print {
    .mermaid-embed-card { border: 0; }
    .mermaid-embed-label { display: none; }
    .mermaid-embed-card { page-break-inside: avoid; background: #fff; }
}

/* ---- Guide/article-embed picker modal (article editor & guide editor toolbars) ---- */
.guide-embed-picker-list { max-height: 320px; overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.guide-embed-picker-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 12px; font-size: 0.9rem; font-weight: 400; color: var(--text); cursor: pointer;
}
.guide-embed-picker-row:hover { background: var(--bg); }
.guide-embed-picker-row .title { font-weight: 600; }
.guide-embed-picker-row .meta { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }

/* ---- Print / PDF export ---- */
@media print {
    .no-print, .topbar, .breadcrumbs, .preview-banner, .card,
    .zoom-btn, .add-marker-hint, .annotation-delete { display: none !important; }
    body { background: #fff; }
    .container { max-width: 100%; padding: 0; }
    .step-card {
        border: none; box-shadow: none; padding: 0; margin-bottom: 24px;
        break-inside: avoid; page-break-inside: avoid;
    }
    .step-card img { max-height: none; }
    .click-marker::after { animation: none; }
}

/* ---- Help centre search: matched-term highlight + excerpt ---- */
mark {
    background: rgba(250, 204, 21, 0.4); color: inherit;
    border-radius: 2px; padding: 0 1px;
}
.guide-row .meta.snippet { display: block; }
a:hover .guide-row.meta { text-decoration: none !important; }

/* ---- Help centre: "Most viewed this month" grid ----
   Up to 6 items (kbMostViewedThisMonth), so 3 / 2 / 1 columns keep the
   rows full rather than leaving an orphan card. */
.kb-popular-strip {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 4px;
}
@media (max-width: 760px) { .kb-popular-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .kb-popular-strip { grid-template-columns: 1fr; } }
.kb-popular-card {
    display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; text-decoration: none; color: inherit;
}
.kb-popular-card:hover { border-color: var(--primary); text-decoration: none; }
.kb-popular-card .title {
    font-weight: 600; overflow: hidden;
    color: var(--primary);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.kb-popular-card .meta { color: var(--text-muted); font-size: 0.85rem; }

/* ---- Help centre: browse-by-category (kb-browse-list) ---- */
.kb-category-list { display: flex; flex-direction: column; gap: 10px; }
.kb-category {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.kb-category summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; cursor: pointer; font-weight: 600; list-style: none;
}
.kb-category summary::-webkit-details-marker { display: none; }
.kb-category summary::before {
    content: '›'; display: inline-block; margin-right: 10px; color: var(--text-muted);
    transition: transform 0.15s ease; transform: rotate(0deg);
}
.kb-category[open] summary::before { transform: rotate(90deg); }
.kb-category summary .meta { font-weight: 400; flex-shrink: 0; }
.kb-category-title { flex: 1; min-width: 0; }
.kb-category-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.kb-category-body > .meta { margin: 14px 0; }
.kb-category-body h4 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 14px 0 8px; }
.kb-category-body .guide-list { gap: 8px; }
.kb-category-link { display: inline-block; margin-top: 14px; font-size: 0.9rem; }

/* ---- Help centre: category panels (one per listed collection) ---- */
/* The heading sits in the flex column, so drop its own bottom margin (the
   list's gap spaces it); extra top space only when "Most viewed" is above. */
.kb-category-list > h2 { margin: 0; }
#kb-popular-section:not([hidden]) + #kb-browse-section .kb-category-list > h2 { margin-top: 24px; }
.kb-panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.kb-panel {
    display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.kb-panel:hover, .kb-panel:focus-visible {
    border-color: var(--primary); text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); transform: translateY(-2px);
}
.kb-panel-image {
    aspect-ratio: 16 / 9; background: var(--primary-tint, var(--surface-alt)); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.kb-panel-image img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.kb-panel-placeholder { font-size: 2.6rem; font-weight: 700; color: var(--primary); line-height: 1; }
.kb-panel-body { padding: 14px 16px 16px; }
.kb-panel-title { font-weight: 600; margin-bottom: 4px; color: var(--primary); }
.kb-panel-desc {
    margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.45;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
@media (prefers-reduced-motion: reduce) { .kb-panel, .kb-panel:hover { transition: none; transform: none; } }

/* ---- Collection editor: help centre cover image ---- */
.collection-cover-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.collection-cover-preview {
    width: 224px; aspect-ratio: 16 / 9; flex-shrink: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius);
}
.collection-cover-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }

/* ---- Help centre: no-results recovery panel ---- */
.kb-noresults p { margin: 0 0 16px; }
.kb-noresults h3 { font-size: 1rem; margin: 0 0 8px; }
.kb-noresults .guide-list { margin-bottom: 20px; }
.kb-request { margin-bottom: 0; }
.kb-request textarea { width: 100%; }

/* ---- Configurable Help Centre identity (see js/branding.js) ---- */
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 28px; width: auto; max-width: 160px; object-fit: contain; flex-shrink: 0; }
.topbar-actions a[href="/screen/help-centre.html"] { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-brand-intro] { white-space: pre-line; }
.brand-contact {
    margin-top: 24px; padding: 14px 18px; text-align: center; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.brand-contact-inline { margin: 0 0 16px; font-weight: 600; }

/* ---- Admin: Help Centre appearance form (js/admin-help.js) ---- */
.help-admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .help-admin-grid { grid-template-columns: 1fr; } }
.help-field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.help-field-error { font-size: 0.85rem; color: var(--danger); margin-top: 4px; min-height: 0; }
.help-field-error:empty { display: none; }
.help-logo-row { display: flex; align-items: center; gap: 16px; }
.help-logo-preview {
    min-width: 96px; height: 52px; padding: 0 12px; display: flex; align-items: center; justify-content: center;
    background: var(--surface-alt); border: 1px dashed var(--border); border-radius: var(--radius);
}
.help-logo-preview img { max-height: 36px; max-width: 160px; object-fit: contain; }
.help-accent-row { display: flex; align-items: center; gap: 8px; }
.help-accent-row input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.help-accent-row input[type=text] { max-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.help-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #ffffff; color: #1f2328; }
.help-preview-bar { padding: 10px 14px; border-bottom: 1px solid var(--border); background: #ffffff; }
.help-preview-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; }
.help-preview-brand img { height: 24px; width: auto; max-width: 120px; object-fit: contain; }
.help-preview-body { padding: 16px 14px; background: #fbe8e1; }
.help-preview-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.help-preview-intro { font-size: 0.85rem; color: #6b7280; white-space: pre-line; margin-bottom: 12px; }
.help-preview-row { display: flex; align-items: center; gap: 14px; }
.help-preview-row button { background: var(--preview-accent, #f9573a); color: #fff; border: none; padding: 6px 14px; border-radius: 10px; font-weight: 600; pointer-events: none; }
.help-preview-row a { color: var(--preview-accent, #f9573a); font-weight: 600; pointer-events: none; }
.help-preview-contact { margin-top: 14px; padding: 10px; text-align: center; background: #ffffff; border: 1px solid #e1e4e8; border-radius: 8px; font-weight: 600; font-size: 0.85rem; }
.help-preview-contact a { color: var(--preview-accent, #f9573a); pointer-events: none; }
.help-preview-contact:empty { display: none; }

/* ---- Ask tab (screen/ask.html) ---- */
#ask-input { width: 100%; }
.ask-answer { white-space: pre-wrap; line-height: 1.55; margin: 0; }
.ask-cite { font-size: 0.75em; vertical-align: super; text-decoration: none; margin-left: 1px; }
.ask-sources-heading { font-size: 1rem; margin: 20px 0 0; }
.ask-sources { margin: 8px 0 0; padding-left: 20px; }
.ask-sources li { margin-bottom: 4px; }
.ask-sources .muted { font-size: 0.85rem; }
.ask-result.ask-unanswered .ask-answer, .ask-history-item.ask-unanswered .ask-answer { color: var(--text-muted); }
#ask-history-section { margin-top: 24px; }
.ask-history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.ask-history-item summary {
    display: flex; align-items: baseline; gap: 10px;
    padding: 12px 16px; cursor: pointer;
}
.ask-history-q { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.ask-history-badge {
    font-size: 0.75rem; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.ask-history-time { font-size: 0.8rem; white-space: nowrap; }
.ask-history-body { padding: 0 16px 16px; }
