/*
 * sbi SPA — phone-first base styles.
 * Intentionally minimal: enough to lay out the shell + listing cards.
 * Card-level classes mirror the live render (iscr-item, i-card, i-list-logo-img, etc.)
 * so future polish can pull the matching rules from /misc/css/scss_25v4/ verbatim.
 */

* { box-sizing: border-box; }
/* overflow-x: clip (not hidden) — clip prevents horizontal page scroll
 * without breaking position: sticky on descendants (.pills-wrap). */
html, body { margin: 0; overflow-x: clip; }
body {
    font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    color: #1a1a1a;
    background: #fafafa;
    padding: 52px 0 64px;          /* clear fixed header (top) + bottom nav */
    -webkit-tap-highlight-color: transparent;
}

/* ─── Header ────────────────────────────────────────────────── */
.hdr {
    position: fixed; inset: 0 0 auto 0; height: 52px;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0 0.5rem;
    background: #1a1a1a; color: #fafafa;
    z-index: 50; box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.hdr-hamburger {
    background: none; border: 0; padding: 0.5rem;
    display: inline-flex; flex-direction: column; gap: 3px; cursor: pointer;
}
.hdr-hamburger span { display: block; width: 22px; height: 2px; background: #fafafa; }
.hdr-title { flex: 1; display: flex; align-items: baseline; gap: 0.4rem; font-weight: 600; font-size: 16px; min-width: 0; }
.hdr-context { font-size: 12px; font-weight: 400; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-icon { display: inline-flex; }
.hdr-actions { display: flex; gap: 0.25rem; align-items: stretch; }
.hdr-actions button { background: none; border: 0; color: #fafafa; font-size: 18px; padding: 0.5rem; cursor: pointer; }
/* Profile button stacks the 👤 icon over a small user_id label when signed in.
   The label is hidden by default and unhidden + populated by main.js → refreshAuthButtons(). */
.hdr-profile {
    display: inline-flex; flex-direction: column; align-items: center;
    line-height: 1; gap: 1px; padding: 0.25rem 0.5rem !important;
}
.hdr-profile-icon { font-size: 18px; }
.hdr-profile-label {
    font-size: 9px; font-weight: 600; letter-spacing: 0.02em;
    max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0.95;
}
.hdr-profile-label[hidden] { display: none; }

/* ─── Drawer ───────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer[data-open] { pointer-events: auto; }
.drawer-scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0; transition: opacity 200ms ease;
}
.drawer[data-open] .drawer-scrim { opacity: 1; }
.drawer-pane {
    position: absolute; inset: 0 auto 0 0;
    width: min(82vw, 320px);
    background: #fff;
    transform: translateX(-100%); transition: transform 220ms ease;
    display: flex; flex-direction: column;
    padding: 1rem 0;
    box-shadow: 2px 0 12px rgba(0,0,0,.25);
}
.drawer[data-open] .drawer-pane { transform: translateX(0); }
.drawer-items { flex: 1; overflow-y: auto; padding: 0.25rem 0; }
.drawer-group summary { padding: 0.75rem 1rem; cursor: pointer; font-weight: 600; }
.drawer-group a { display: block; padding: 0.5rem 1.5rem; color: #333; text-decoration: none; }
.drawer-group a:hover { background: #f0f0f0; }

/* Top-level leaf rendered as a "drawer-group" wrapper so its <a> picks up
   the .drawer-group a styling above. There's no body to expand/collapse,
   so we hide the disclosure marker and let the link's own padding take
   over the summary row. <details open> + this CSS makes it look like a
   plain flat link visually consistent with the other drawer-group items. */
.drawer-group.spa-menu-leaf > summary { padding: 0; cursor: default; list-style: none; font-weight: normal; }
.drawer-group.spa-menu-leaf > summary::-webkit-details-marker { display: none; }
.drawer-group.spa-menu-leaf > summary::marker { content: ''; }
.drawer-placeholder { padding: 1.5rem 1rem; color: #999; font-style: italic; font-size: 13px; }

/* muxmenu output — emitted by /api/v1/module?name=muxmenu. The wrapping
   <div class="spa-menu-root"> sits inside .drawer-items; its children are
   <details class="drawer-group">, <div class="spa-menu-item">,
   <hr class="spa-menu-sep">, and <p class="spa-menu-blurb">. */
.spa-menu-root { display: block; }
.spa-menu-heading {
    display: block;
    padding: 0.5rem 1rem;
    margin: 0;
    font-size: 1.1rem; font-weight: 600; letter-spacing: 0.02em;
} /* text-transform: uppercase; */
.spa-menu-item { display: block; }
/* Wrapper around a parent menu's children inside <details class="drawer-group">.
   The left padding shifts nested <summary> markers / leaf links so they sit
   under the parent's text rather than under the parent's marker. ~1em is
   roughly the disclosure-triangle width — adjust together if you change the
   summary padding above. */
.drawer-group-body { padding-left: 1em; }
.spa-menu-sep {
    border: 0; border-top: 1px solid #eee;
    margin: 0.4rem 1rem;
}
.spa-menu-blurb {
    padding: 0.4rem 1.5rem;
    font-size: 12px; color: #666; font-style: italic;
}
.spa-menu-blurb-title {
    font-style: normal; font-weight: 600;
    font-size: 12px; color: #444;
    margin-bottom: 0.2rem;
}
.spa-menu-blurb-desc {
    margin-top: 0.15rem;
    font-size: 11px; color: #888;
}
/* Tighten any block tags the admin embedded inside menu_description
   (the column accepts <p>/<br>/<a>). Default browser <p> margins are
   too generous for the drawer's compact spacing. */
.spa-menu-blurb p {
    margin: 0 0 0.3rem;
    font-size: 11px;
    line-height: 1.35;
}
.spa-menu-blurb p:last-child { margin-bottom: 0; }
/* Override the block-style .drawer-group a rule for inline links inside
   blurbs (typically "See <site>/about-posting-content for details"). */
.spa-menu-blurb a {
    display: inline;
    padding: 0;
    color: #2469b3;
    text-decoration: underline;
}
.spa-menu-blurb a:hover {
    background: transparent;
    color: #1a4e8a;
}
.drawer-menu-loading, .drawer-menu-error {
    padding: 0.75rem 1rem;
    font-size: 13px; color: #888;
}
.drawer-menu-error { color: #b33b3b; }
.drawer-auth { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; border-top: 1px solid #eee; }
.drawer-auth [hidden] { display: none; }

/* Language picker — populated lazily by i18n.js when more than one
   enabled language exists. Sits between the menu items and the auth
   buttons; thin separator continues the drawer-auth visual style. */
.drawer-lang { padding: 0.6rem 1rem; border-top: 1px solid #eee; }
.drawer-lang-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 13px; color: #555;
}
.drawer-lang-select {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d0d0d0; border-radius: 4px;
    background: #fff; color: #1a1a1a;
    font-size: 13px;
}
.drawer-lang-select:focus { outline: 2px solid #2469b3; outline-offset: 1px; }
.drawer-user {
    font-size: 13px; color: #555;
    padding: 0.1rem 0 0.4rem;
}
.drawer-user strong { color: #1a1a1a; }

/* ─── Pills (Browse mode) ─────────────────────────────────── */
.pills-wrap {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 52px;                    /* directly under fixed header */
    z-index: 40;
}
.pill-row {
    display: flex; flex-wrap: nowrap; gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    width: 100%;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    user-select: none;
    cursor: grab;
}
.pill-row.is-dragging { cursor: grabbing; }
.pill-row::-webkit-scrollbar { display: none; }
.pill-row-cats { padding-top: 0; padding-bottom: 0.35rem; }
/* Specificity > UA [hidden] { display: none } — without this, .pill-row's
 * display:flex wins and a hidden row still renders. */
.pill-row[hidden] { display: none; }
.pill {
    flex: 0 0 auto;
    padding: 0.25rem 0.7rem;
    border: 1px solid #d0d0d0; border-radius: 999px;
    background: #fff; color: #333;
    font-size: 12px; line-height: 1.4; cursor: pointer; white-space: nowrap;
}
.pill[data-active] { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

/* ─── Main view ───────────────────────────────────────────── */
.view { min-height: calc(100vh - 116px); padding: 0.5rem; }
.view-empty { text-align: center; color: #888; padding: 2rem 1rem; }
.view-loading { text-align: center; color: #888; padding: 2rem 1rem; }

/* ─── Bottom nav ──────────────────────────────────────────── */
.bottom-nav {
    position: fixed; inset: auto 0 0 0; height: 64px;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: #1a1a1a; color: #cfcfcf;
    z-index: 50; box-shadow: 0 -1px 0 rgba(0,0,0,.2);
}
.bn-tab {
    background: none; border: 0; color: inherit; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 4px 2px;
}
.bn-icon { font-size: 22px; line-height: 1; }
.bn-label { font-size: 11px; }
.bn-tab[data-active] { color: #fff; background: #2a2a2a; }

/* ─── Toasts ───────────────────────────────────────────────
 * Color/kind mapping:
 *   .toast--success → green   (login OK, saved, sent)
 *   .toast--info    → yellow  (informational, no action needed)
 *   .toast--warn    → amber (dark text; recoverable transition, actionable reminder)
 *   .toast--error   → red     (4xx/5xx surface, rate limit, login failed)
 * Region is fixed bottom-right on wider screens, bottom-stretch on phones.
 * Newest toast prepended at the top of the column.
 */
.toast-region {
    position: fixed;
    inset: auto 0.75rem 80px 0.75rem;   /* clear the 64px bottom-nav + breathing room */
    z-index: 90;
    display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none;               /* let underlying UI receive clicks where no toast covers */
}
@media (min-width: 720px) {
    .toast-region {
        inset: auto 1rem 1rem auto;
        max-width: 360px;
    }
}
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.18);
    color: #fff;
    font-size: 14px; line-height: 1.35;
    animation: toast-in 180ms ease-out;
}
.toast.is-leaving { animation: toast-out 180ms ease-in forwards; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(4px); }
}
.toast-body  { flex: 1 1 auto; word-wrap: break-word; }
.toast-close {
    flex: 0 0 auto;
    background: transparent; border: 0; color: inherit;
    font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
    padding: 0 0.15rem; opacity: 0.85;
}
.toast-close:hover, .toast-close:focus-visible { opacity: 1; outline: none; }

.toast--success { background: #1e8e3e; }                  /* green  */
.toast--info    { background: #f9c11f; color: #4a3500; }  /* yellow, dark text for contrast */
.toast--warn    { background: #f2b01e; color: #2a1d00; }  /* amber, near-black text for contrast */
.toast--error   { background: #d33232; }                  /* red    */

/* ─── Auth modal ──────────────────────────────────────────── */
.auth-modal {
    border: 0; border-radius: 12px; padding: 1.25rem;
    max-width: 380px; width: 92vw;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.auth-modal::backdrop { background: rgba(0,0,0,.5); }
.auth-modal h3 { margin: 0 0 0.5rem; }
.auth-modal-hint { color: #666; font-size: 13px; margin: 0 0 0.75rem; }
/* Match every text-like input — including `<input name="...">` with no
 * explicit type= (browser default is 'text' but the attribute selector
 * `[type="text"]` does NOT match the missing-attribute case, hence the
 * `:not([type])` branch). Excludes checkboxes / radios / hidden / etc. */
.auth-modal input[type="text"],
.auth-modal input[type="email"],
.auth-modal input[type="password"],
.auth-modal input[type="search"],
.auth-modal input:not([type]) {
    width: 100%; padding: 0.5rem 0.6rem;
    border: 1px solid #ccc; border-radius: 6px; font: inherit;
    box-sizing: border-box;
    background: #fff; color: #1a1a1a;
}
.auth-modal input:focus { outline: 2px solid #1a73e8; outline-offset: 1px; border-color: #1a73e8; }
.auth-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* ── Tabbed profile modal + Service Accounts (BYOK) pane ─────────────────── */
.auth-modal:has(.sa-tabs) { max-width: 460px; }
.auth-modal select {
    width: 100%; padding: 0.5rem 0.6rem;
    border: 1px solid #ccc; border-radius: 6px; font: inherit;
    box-sizing: border-box; background: #fff; color: #1a1a1a;
}
.sa-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid #e3e3e3; margin: 0 0 0.9rem; }
.sa-tab {
    appearance: none; background: transparent; border: 0; font: inherit;
    padding: 0.5rem 0.75rem; cursor: pointer; color: #666;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sa-tab[aria-selected="true"] { color: #1a1a1a; border-bottom-color: #1a73e8; font-weight: 600; }
.sa-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.sa-empty { color: #888; font-size: 13px; padding: 0.75rem 0; text-align: center; }
.sa-row {
    border: 1px solid #e3e3e3; border-radius: 8px; padding: 0.6rem 0.7rem;
    display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.5rem;
}
.sa-row-main    { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; }
.sa-name        { font-weight: 600; color: #1a1a1a; font-size: 14px; }
.sa-type        { color: #777; font-size: 12px; }
.sa-row-meta    { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 0.5rem; }
.sa-key         { font-family: ui-monospace, monospace; font-size: 12px; color: #555; }
.sa-status      { font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.sa-status[data-st="ok"]   { background: #e6f4ea; color: #1e7e34; }
.sa-status[data-st="bad"]  { background: #fce8e6; color: #c5221f; }
.sa-status[data-st="warn"] { background: #fef7e0; color: #a56100; }
.sa-row-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 0.3rem; justify-content: center; }
.btn.sa-sm      { padding: 0.25rem 0.55rem; font-size: 12px; }

/* "Connect messaging" pane (Signal / WhatsApp / Telegram linking). */
.mc-list      { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.mc-row       { border: 1px solid #e3e3e3; border-radius: 8px; padding: 0.65rem 0.75rem; }
.mc-head      { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.mc-icon      { font-size: 18px; line-height: 1; }
.mc-label     { font-weight: 600; color: #1a1a1a; font-size: 14px; }
.mc-form      { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.mc-form input { flex: 1 1 10rem; min-width: 0; padding: 0.45rem 0.55rem;
                 border: 1px solid #ccc; border-radius: 6px; font: inherit; box-sizing: border-box; }
.btn.mc-sm    { padding: 0.35rem 0.7rem; font-size: 13px; white-space: nowrap; }
.mc-hint      { color: #888; font-size: 12px; margin: 0.4rem 0 0; }
.mc-note      { color: #555; font-size: 13px; margin: 0 0 0.5rem; }
.mc-connected { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.mc-identity  { font-family: ui-monospace, monospace; font-size: 13px; color: #333; }
.mc-badge     { font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.mc-badge[data-st="ok"]   { background: #e6f4ea; color: #1e7e34; }
.mc-badge[data-st="warn"] { background: #fef7e0; color: #a56100; }

/* Tab strip at the top of the modal. */
.auth-tabs {
    display: flex; gap: 0.25rem;
    border-bottom: 1px solid #e5e5e5;
    margin: 0 -0.25rem 0.75rem;
}
.auth-tab {
    flex: 1 1 0;
    background: none; border: 0;
    padding: 0.5rem 0.4rem;
    font: inherit; font-size: 13px; cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
}
.auth-tab:hover { color: #1a1a1a; }
.auth-tab.is-active,
.auth-tab[aria-selected="true"] {
    color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600;
}

/* Row pattern reused across all forms in the modal. */
.auth-row { display: block; margin-bottom: 0.6rem; font-size: 13px; color: #555; }
.auth-row > span { display: block; margin-bottom: 0.2rem; }
/* Inline policy spec under password / username labels. Renders as a thin
 * separator-joined list (e.g. "min 10 chars · uppercase · digit · special")
 * sized smaller than the label so it doesn't fight for attention. */
.auth-hint {
    color: #888;
    font-size: 11px;
    font-weight: 400;
    margin-left: 0.4rem;
}
.auth-row-inline {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 13px; color: #555;
}
.auth-row-inline > span { margin: 0; }
.auth-captcha-img {
    border: 1px solid #ddd; border-radius: 4px;
    max-width: 100%; vertical-align: middle;
    margin-right: 0.4rem;
}
.auth-captcha-refresh {
    padding: 0.25rem 0.5rem; font-size: 13px;
}

/* Inline status line under the form — colour-coded by data-kind. */
.auth-status {
    min-height: 1.2em;
    font-size: 13px; margin: 0.4rem 0 0.2rem;
    color: #555;
}
.auth-status[data-kind="error"]   { color: #c62828; }
.auth-status[data-kind="success"] { color: #2e7d32; }
.auth-status[data-kind="warn"]    { color: #b26a00; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn { padding: 0.55rem 1rem; border: 1px solid transparent; border-radius: 6px; font: inherit; cursor: pointer; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-ghost   { background: transparent; color: #1a73e8; border-color: #1a73e8; }

/* ─── Cards (match live render classes) ───────────────────── */
.iscr-container { padding-top: 0.5rem; }
.iscr-container.list-list { display: flex; flex-direction: column; gap: 0.75rem; }

/* Grid mode (e.g. Media). Bootstrap-equivalent for the col-sm-12 / col-md-4 /
 * col-xl-4 classes the legacy grid block emits, without pulling in Bootstrap. */
.iscr-container.list-grid {
    display: flex; flex-wrap: wrap;
    gap: 0.6rem; padding: 0 0.5rem 0.5rem;
}
/* flex-grow: 0 keeps last-row partial cards at the calculated column width
 * instead of stretching to fill the remaining track. */
.iscr-container.list-grid .iscr-item { flex: 0 1 100%; }
@media (min-width: 600px) {
    .iscr-container.list-grid .iscr-item { flex: 0 1 calc(50% - 0.3rem); }
}
@media (min-width: 900px) {
    .iscr-container.list-grid .iscr-item { flex: 0 1 calc(33.333% - 0.4rem); }
}

/* Grid-card internals — thumbnail full width on top, info below. */
.list-grid .i-card { padding: 0.6rem; background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.list-grid .i-logo-container-w100 {
    width: 100%; aspect-ratio: 16 / 9;
    overflow: hidden; border-radius: 4px;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #f4f4f4 0%, #e8e8e8 100%);
}
.list-grid .i-grid-logo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-grid .i-grid-logo-placeholder {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #f4f4f4 0%, #e8e8e8 100%);
}
.list-grid .i-title h3 { font-size: 15px; }
.list-grid .i-summary-text { max-height: 4em; font-size: 13px; }
.iscr-item { background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.08); overflow: hidden; }
.i-card { padding: 0.75rem; gap: 0.5rem; }
.i-main { gap: 0.25rem; }
.i-url-domain { font-size: 11px; color: #4a90e2; word-break: break-all; }
.i-url-stem { display: none; }
.i-title h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.i-title a { color: inherit; text-decoration: none; }
/* Reserve a fixed 96×96 slot so the layout never reflows when an image
 * loads, errors, or is missing entirely. The img itself is forced to the
 * same dimensions so alt text can't expand the box. */
.i-logo-container {
    flex: 0 0 96px; width: 96px; height: 96px;
    margin-right: 0.75rem;
    display: flex; align-items: flex-start; justify-content: center;
    overflow: hidden;
}
.i-list-logo-img,
.i-list-default-img {
    width: 96px; height: 96px; object-fit: cover; border-radius: 6px;
    /* Hide the alt-text flash when src is empty/broken. */
    font-size: 0; color: transparent;
    /* Soft gradient so a missing/404'd thumbnail blends into the card
     * instead of punching a hard dark hole. Matches .item-publisher-thumb. */
    background: linear-gradient(135deg, #f4f4f4 0%, #e8e8e8 100%);
}
/* When the src is missing (e.g. onerror just stripped it after a 404),
 * Chrome/Edge still render a small broken-image glyph centered in the
 * <img> box. Replace the image content with an empty inline SVG so the
 * box renders as pure background gradient — no glyph, no border. */
.i-list-logo-img:not([src]),
.i-list-logo-img[src=""],
.i-list-default-img:not([src]),
.i-list-default-img[src=""],
.item-publisher-thumb:not([src]),
.item-publisher-thumb[src=""] {
    content: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'></svg>");
}
.i-info-container { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.35rem; }
.i-date { font-size: 12px; color: #888; }
.i-summary-text { font-size: 14px; color: #333; position: relative; max-height: 5.6em; overflow: hidden; }
.i-summary-text a { color: inherit; text-decoration: none; }
.i-summary-fade {
    /* disabled */
}
/*
.i-summary-fade {
    position: absolute; inset: auto 0 0 0; height: 1.4em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
}
*/

.i-nav.i-controls-row { margin-top: 0.25rem; }
/* Star rating — matches the markup emitted by build_star_rating_html()
 * in includes/function.php: <span class="rating"><i class="glyphicon
 * glyphicon-star [empty|half]"></i>…</span>. The legacy site uses a
 * Bootstrap glyphicon font; we don't load that in the SPA, so render each
 * <i> as a Unicode star via ::before content. Half-star is approximated
 * with reduced opacity (good enough for a phone card; can be sharpened
 * later with a clip-path if needed). */
.rating { display: inline-flex; gap: 1px; line-height: 1; }
.rating i.glyphicon-star {
    font-style: normal; font-size: 14px; color: #f5b50a;
    width: 1em; height: 1em;
    display: inline-flex; align-items: center; justify-content: center;
}
.rating i.glyphicon-star::before { content: '\2605'; }   /* ★ */
.rating i.glyphicon-star.empty { color: #d4d4d4; }
.rating i.glyphicon-star.empty::before { content: '\2606'; }   /* ☆ */
.rating i.glyphicon-star.half { opacity: 0.55; }
.i-rating-box .rating i { color: #f5b50a; font-style: normal; }

/* Utility: Bootstrap-ish flex helpers used by the card markup */
.d-flex { display: flex; }
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.align-content-center { align-content: center; }
.justify-content-center { justify-content: center; }

/* ─── Item-detail view ─────────────────────────────────────── */
.item-view {
    background: #fff;
    border-radius: 6px;
    padding: 1rem;
    margin: 0 auto;
    max-width: 760px;
}
.item-back {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: #f4f4f4;
    border: 1px solid #d8d8d8; border-radius: 999px;
    color: #1a1a1a;
    font-size: 14px; line-height: 1; cursor: pointer;
    padding: 0.35rem 0.85rem 0.35rem 0.6rem;
    margin: 0 0 0.75rem;
    /* Clear the 52-px fixed .hdr at the top of the viewport. Without an
       offset >= header height the button would stick UNDER the opaque header
       and look like it isn't sticking at all. */
    position: sticky;
    top: 60px;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: padding 140ms ease, font-size 140ms ease,
                background 140ms ease, border-color 140ms ease,
                box-shadow 140ms ease, backdrop-filter 140ms ease;
}
/* Scrolled state — once the user scrolls past the small threshold defined in
   installScrollStateTracker(), <body data-scrolled> flips on. The sticky Back
   button shrinks (smaller padding + font) and becomes semi-transparent so
   it doesn't dominate the article reading area. Hovering or focusing
   restores full opacity for tap accuracy. */
body[data-scrolled] .item-back {
    padding: 0.2rem 0.6rem 0.2rem 0.45rem;
    font-size: 12px;
    background: rgba(244, 244, 244, 0.65);
    border-color: rgba(216, 216, 216, 0.55);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
body[data-scrolled] .item-back:hover,
body[data-scrolled] .item-back:focus-visible {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
/* Icon-only when scrolled — hide the "Back" label so the button collapses
   to a circular chevron. Slightly larger SVG since it's the sole element. */
body[data-scrolled] .item-back-arrow { width: 18px; height: 18px; }
body[data-scrolled] .item-back-text  { display: none; }
body[data-scrolled] .item-back       { gap: 0; padding: 0.25rem 0.45rem; }
.item-back:hover, .item-back:focus-visible {
    background: #1a1a1a; color: #fff; border-color: #1a1a1a;
    outline: none;
}
/* SVG chevron — symmetric by design, no font-metric optical nudges needed.
   Sized in px so it stays predictable across the button states. */
.item-back-arrow {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}
.item-back-text { font-weight: 500; }
.item-title {
    font-size: 22px; line-height: 1.25; margin: 0 0 0.5rem;
    word-wrap: break-word;
}
.item-title a { color: #1a1a1a; text-decoration: none; }
.item-title a:hover { text-decoration: underline; }
.item-meta {
    color: #777; font-size: 13px; margin-bottom: 0.75rem;
}
.item-meta-by { color: #999; }
.item-meta-link { color: #555; text-decoration: none; }
.item-meta-link:hover { text-decoration: underline; }
.item-meta-chat {
    display: inline-block; margin-left: .5em; padding: .05em .5em;
    background: #0057b7; color: #fff !important; border-radius: 12px;
    font-size: 12px; text-decoration: none; line-height: 1.6;
}
.item-meta-chat:hover { background: #0068d6; }

/* ─── chat view (member-to-member DM) ────────────────────────────────── */
/* Fixed viewport slice so Deep Chat's internal layout (scrollable
   message pane on top, input pinned to bottom) has a definite height to
   compute against. Matches .view's min-height so the chat fills the
   same vertical band without page-scrolling. */
.chat-view {
    display: flex; flex-direction: column;
    height: calc(100vh - 116px); min-height: 400px;
    padding: 0.75rem 0.5rem;
}
.chat-header {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.chat-title {
    margin: 0; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 1.05em;
}
.chat-status  { font-size: .85em; color: #888; white-space: nowrap; }
.chat-meta    { font-size: .8em;  color: #888; margin-bottom: 0.5rem; }

/* Partner-presence indicator — small colored dot in the meta line.
   Green = online, gray = offline; semantic conveyed via title/aria. */
.chat-presence {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; vertical-align: middle;
    background: #b0b0b0;
}
.chat-presence-online  { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.18); }
.chat-presence-offline { background: #b0b0b0; }

/* MITM-verification fingerprint pill sits inline in the meta line.
   Chat-view lives in the SPA's light body theme (only the Deep Chat
   mount is dark), so the pill needs gray text on the light backdrop
   with a soft border. Hover darkens the text only — background and
   border stay put so the affordance moves in one visual dimension. */
.chat-fp {
    display: inline-block; margin-left: .25em;
    background: transparent; border: 1px solid #ccc; color: #888;
    padding: .05em .55em; border-radius: 10px;
    font: inherit; font-size: .95em; cursor: pointer;
}
.chat-fp:hover     { color: #333; }
.chat-fp-verified {
    background: #4caf50; color: #fff; border-color: #3e8e41;
}
.chat-fp-verified:hover { background: #3f9c43; color: #fff; }
.chat-fp-words {
    display: block; margin: .75rem 0;
    padding: .75rem 1rem;
    background: #0d0d0d; border: 1px solid #333; border-radius: 6px;
    color: #eee; font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1.1em; letter-spacing: .04em; text-align: center;
    user-select: all;
}
.chat-exit, .chat-clear, .chat-back {
    border: none; background: transparent; color: #aaa;
    font-size: 1.1em; line-height: 1; padding: .3em .5em;
    cursor: pointer; border-radius: 6px;
}
.chat-exit { font-size: 1.4em; padding: .15em .4em; }
.chat-back { font-size: 1.4em; padding: .15em .5em; font-weight: 600; }
.chat-exit:hover, .chat-clear:hover, .chat-back:hover { background: #333; color: #eee; }
.chat-clear:hover { color: #ff8080; }

/* Voice input — mic button + transcript-preview bar. */
[data-ai-voice-mic] { display: inline-flex; align-items: center; justify-content: center; }
[data-ai-voice-mic] svg { display: block; }
[data-ai-voice-mic]:hover { color: #eee; }
[data-ai-voice-mic].is-recording { color: #ff5b5b; animation: ai-voice-pulse 1.1s ease-in-out infinite; }
[data-ai-voice-mic].is-busy { color: #6c8ea6; opacity: .8; cursor: default; }
@keyframes ai-voice-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Read-aloud (🔊) toggle — highlighted when active. */
[data-ai-speak].is-on { color: #4ea1ff; }
[data-ai-speak].is-on:hover { color: #7bbcff; }

/* Read-aloud voice picker modal (🗣️). Rows: ▶ preview · name/desc · ✓ current. */
.vm-section-label { color: #7f8c99; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; margin: .2rem 0 .4rem; }
.vm-providers { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.vm-prov {
    flex: 1 1 8rem; text-align: left; cursor: pointer;
    display: flex; flex-direction: column; gap: .15rem;
    padding: .45rem .55rem; border: 1px solid #2a3038; border-radius: 8px; background: #14181d;
}
.vm-prov:hover { border-color: #3a4450; }
.vm-prov.is-sel { border-color: #0057b7; background: #12233b; }
.vm-prov-name { color: #eaeef2; font-size: .88rem; font-weight: 600; }
.vm-prov-chips { color: #8b97a3; font-size: .7rem; }
.vm-blurb { color: #9ab; font-size: .82rem; line-height: 1.5; margin: 0 0 .8rem; }
.vm-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
.vm-msg { color: #889; font-size: .85rem; padding: 1rem 0; text-align: center; }
.vm-row {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .55rem; border: 1px solid #262b31; border-radius: 8px;
    background: #14181d; cursor: pointer;
}
.vm-row:hover { background: #1b2027; border-color: #333a42; }
.vm-row.is-current { border-color: #0057b7; background: #12233b; }
.vm-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.vm-name { color: #eaeef2; font-size: .92rem; font-weight: 600; }
.vm-desc { color: #8b97a3; font-size: .76rem; }
.vm-check { color: #4ea1ff; font-weight: 700; flex: 0 0 auto; }
.vm-prev {
    flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%;
    border: 1px solid #37506f; background: #10233d; color: #cfe0f5;
    font-size: .72rem; cursor: pointer; line-height: 1;
}
.vm-prev:hover { background: #163254; border-color: #4a6f9c; }

.ai-voice-bar {
    display: flex; align-items: flex-end; gap: .4rem;
    padding: .45rem .6rem; border-bottom: 1px solid #333; background: #14181d;
}
.ai-voice-bar[hidden] { display: none; }
.ai-voice-text {
    flex: 1 1 auto; min-width: 0; box-sizing: border-box;
    min-height: 3.4em; max-height: 40vh; overflow-y: auto; resize: vertical;
    padding: .45rem .55rem; line-height: 1.4;
    background: #1a1a1a; color: #eee; border: 1px solid #333; border-radius: 6px; font: inherit;
}
.ai-voice-text:focus { outline: none; border-color: #0057b7; }
/* Send/discard sit at the bottom edge next to a tall textarea. */
.ai-voice-bar .ai-voice-send, .ai-voice-bar .ai-voice-cancel { margin-bottom: 1px; }
.ai-voice-send, .ai-voice-cancel {
    flex: 0 0 auto; border: none; border-radius: 6px; cursor: pointer;
    padding: .4rem .6rem; font-size: 1em; line-height: 1;
}
.ai-voice-send   { background: #0057b7; color: #fff; }
.ai-voice-send:hover   { background: #0068d6; }
.ai-voice-cancel { background: transparent; color: #aaa; }
.ai-voice-cancel:hover { background: #333; color: #eee; }

/* Confirmation modal (scoped to .chat-view so it doesn't leak) */
.chat-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.chat-modal {
    background: #1a1a1a; color: #eee; border: 1px solid #444;
    border-radius: 8px; padding: 1.25rem 1.5rem;
    max-width: 420px; width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.chat-modal-title { margin: 0 0 .5rem 0; font-size: 1.1em; }
.chat-modal-body  { color: #ccc; font-size: .95em; line-height: 1.4; margin-bottom: 1rem; }
.chat-modal-actions {
    display: flex; gap: .5rem; justify-content: flex-end;
}
/* Scoped modal buttons — deliberately NOT sharing .btn styling so the
   destructive-action modal palette is stable regardless of what global
   .btn variants get added elsewhere. */
.chat-modal-cancel,
.chat-modal-confirm {
    min-width: 100px; padding: .55rem 1rem; border-radius: 6px;
    font: inherit; cursor: pointer; border: 1px solid transparent;
}
/* Cancel: white background, stays white on hover — reinforces it as
   the safe/preselected option in a destructive confirm. */
.chat-modal-cancel {
    background: #ffffff; color: #1a1a1a; border-color: #c9c9c9;
}
.chat-modal-cancel:hover,
.chat-modal-cancel:focus {
    background: #ffffff; color: #1a1a1a; outline: 2px solid #0057b7;
    outline-offset: 1px;
}
.chat-modal-confirm { background: #1a73e8; color: #fff; }
.chat-modal-confirm:hover { background: #185abc; }
.chat-modal-danger  { background: #c62828; color: #fff; }
.chat-modal-danger:hover { background: #a91d1d; }
.chat-mount   { flex: 1; min-height: 0; }

/* ── Hermes CLI overlay (app/js/ui/hermes-cli.js) ── */
.hermes-cli-overlay { position: fixed; inset: 0; z-index: 4000; background: rgba(0,0,0,.85); display: flex; }
.hermes-cli { margin: auto; width: 96vw; height: 94vh; display: flex; flex-direction: column;
  background: #0d0d0d; border: 1px solid #333; border-radius: 8px; overflow: hidden; }
.hermes-cli-bar { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem;
  background: #161616; border-bottom: 1px solid #2a2a2a; }
.hermes-cli-title { color: #9ab; font-weight: 600; }
.hermes-cli-btn { background: #222; color: #ccc; border: 1px solid #3a3a3a; border-radius: 5px;
  padding: .25rem .55rem; cursor: pointer; font-size: .85em; }
.hermes-cli-btn:hover { background: #2c2c2c; color: #fff; }
.hermes-cli-body { flex: 1 1 auto; display: flex; min-height: 0; }
.hermes-cli-term { flex: 1 1 auto; border: 0; background: #000; }
.hermes-cli-sheet { width: 320px; flex: 0 0 320px; border-left: 1px solid #2a2a2a;
  overflow-y: auto; background: #111; transition: flex-basis .15s, width .15s; }
.hermes-cli-sheet.collapsed { flex-basis: 0; width: 0; overflow: hidden; border-left: 0; }
.hermes-cli-sheet-inner { padding: .6rem .8rem; color: #cdd; font-size: .82em; line-height: 1.5; }
.hermes-cli-sheet-inner h4 { color: #6c8ea6; margin: .9rem 0 .3rem; font-size: .9em;
  border-bottom: 1px solid #243; padding-bottom: .2rem; }
.hermes-cli-sheet-inner ul { margin: .2rem 0; padding-left: 1.1rem; }
.hermes-cli-sheet-inner li { margin: .2rem 0; }
.hermes-cli-sheet-inner p { margin: .3rem 0; color: #aab; }
.hermes-cli-sheet-inner code { background: #000; color: #7ec699; padding: 0 .3em; border-radius: 3px; }
@media (max-width: 640px) {
  .hermes-cli-body { flex-direction: column; }
  .hermes-cli-sheet { width: auto; flex: 0 0 42%; border-left: 0; border-top: 1px solid #2a2a2a; }
}
/* Audio bubbles get the fully-rounded pill treatment — media element
   fills the whole bubble so the play/scrub controls are unclipped. */
.audio-player { width: 100%; height: 100%; }

/* ─── chat list (bare #chat) ─────────────────────────────────────────── */
.chat-list-view { position: relative; }
.chat-list {
    flex: 1; min-height: 0; overflow-y: auto;
    border: 1px solid #333; border-radius: 8px; background: #111;
}
.chat-list-empty, .chat-list-loading {
    padding: 2rem 1rem; text-align: center; color: #888; font-size: .95em;
}
.chat-list-row {
    display: flex; gap: .75rem; padding: .65rem .8rem;
    border-bottom: 1px solid #222; cursor: pointer;
    transition: background .1s;
}
.chat-list-row:last-child { border-bottom: 0; }
.chat-list-row:hover { background: #1a1a1a; }

.chat-avatar {
    flex: 0 0 44px; width: 44px; height: 44px;
    border-radius: 50%; background: #2a3550; color: #dde;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 1.1em; user-select: none;
    overflow: hidden; position: relative;
}
.chat-avatar-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
/* When we have no avatar image (or it failed to load), the parent
   `chat-avatar-fallback` class flips on and the letter initial —
   pulled from a data-attribute so no wrapper element is needed —
   renders via ::after. */
.chat-avatar-fallback::after {
    content: attr(data-initial);
    color: #dde;
}
.chat-row-main {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: .1rem;
}
.chat-row-top {
    display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
}
.chat-row-name {
    flex: 1; min-width: 0;
    color: #eee; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row-mode {
    display: inline-block; margin-left: .4em; padding: 0 .4em;
    border-radius: 3px; font-size: .7em; font-weight: 400; vertical-align: middle;
    color: #ccc; background: #333;
}
.chat-row-mode-ephemeral { background: #7a5c00; color: #fff; }
.chat-row-mode-session   { background: #5a2f7a; color: #fff; }
.chat-row-date {
    flex: 0 0 auto; color: #888; font-size: .78em; white-space: nowrap;
}
.chat-row-preview {
    display: flex; align-items: center; gap: .35rem;
    color: #aaa; font-size: .87em; min-width: 0;
}
.chat-row-snip {
    flex: 1; min-width: 0;
    overflow: hidden; white-space: nowrap;   /* single line, NO ellipsis per spec */
}
.chat-ticks {
    flex: 0 0 auto; font-size: .9em; letter-spacing: -2px;
}
.chat-ticks-sent      { color: #4fc3f7; }   /* cyan single tick */
.chat-ticks-delivered { color: #888; }      /* grey double tick */
.chat-ticks-read      { color: #4fc3f7; }   /* cyan double tick (phase 5b) */

/* "Start a chat" picker (route #chat/new) */
.chat-user-picker { max-width: 520px; padding: 1rem .5rem; }
.chat-picker-hint {
    color: #aaa; font-size: .9em; margin: 0 0 1rem 0;
}
.chat-picker-form {
    display: flex; gap: .5rem; align-items: center;
}
.chat-picker-input {
    flex: 1; padding: .55rem .75rem; font-size: 1em;
    background: #1a1a1a; color: #eee;
    border: 1px solid #333; border-radius: 6px;
}
.chat-picker-input:focus { outline: none; border-color: #0057b7; }
.chat-picker-continue {
    flex: 0 0 auto; width: 44px; height: 44px;
    border: none; border-radius: 50%;
    background: #0057b7; color: #fff;
    font-size: 1.4em; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.chat-picker-continue:hover  { background: #0068d6; }
.chat-picker-continue:active { background: #004a9a; }

/* Floating "+" new-chat button, WhatsApp-style */
.chat-list-new {
    position: absolute; bottom: 1.5rem; right: 1.5rem;
    width: 56px; height: 56px; border-radius: 50%;
    border: none; background: #22c55e; color: #fff;
    font-size: 2em; line-height: 1; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    transition: background .1s, transform .05s;
}
.chat-list-new:hover  { background: #16a34a; }
.chat-list-new:active { transform: translateY(1px); }
.item-controls {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    margin: 0.75rem 0;
}
.item-import-panel {
    margin: 0.5rem 0 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff8e6;
    border: 1px solid #e5d08a;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}
.item-import-panel-error { background: #fdecec; border-color: #e5b0a8; }
.item-import-heading {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7a5a00;
    margin-bottom: 0.25rem;
}
.item-import-panel-error .item-import-heading { color: #7a2a1f; }
.item-import-line { margin: 0.1rem 0; }
.item-import-muted { color: #8a7a3a; }
.item-import-error { color: #7a2a1f; }
.item-import-link { font-weight: 500; }
.item-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid #d0d0d0; border-radius: 6px;
    background: #fff; color: #333;
    font-size: 13px; line-height: 1.2; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
.item-btn:hover { background: #f5f5f5; }
.item-btn-icon { font-size: 14px; }
.item-related-trigger { margin: 0.5rem 0 1rem; }
.item-btn-related {
    background: #1a1a1a; color: #fff; border-color: #1a1a1a;
}
.item-btn-related:hover { background: #333; }
.item-image-small {
    width: 50%; max-width: 320px;
    margin: 0.5rem auto 1rem; text-align: center;
}
.item-image-small img { max-width: 100%; height: auto; }
.item-image-big { margin: 0.5rem 0 1rem; }
.item-image-big img { width: 100%; height: auto; border-radius: 4px; }
.item-summary {
    font-size: 15px; color: #444;
    margin: 0.75rem 0;
    padding: 0.75rem; background: #f7f7f7;
    border-left: 3px solid #d0d0d0; border-radius: 4px;
}
.item-body {
    font-size: 15px; line-height: 1.6; color: #1a1a1a;
    margin: 1rem 0;
    word-wrap: break-word; overflow-wrap: break-word;
}
.item-body img { max-width: 100%; height: auto; }
.item-body p { margin: 0 0 1em; }
.item-body a { color: #2469b3; }
.item-source-link {
    margin: 1.5rem 0;
    padding: 0.75rem;
    background: #f7f7f7; border-radius: 6px;
    text-align: center;
}
.item-source-link a {
    color: #1a1a1a; font-weight: 600; text-decoration: none;
    font-size: 15px;
}
.item-source-link a:hover { text-decoration: underline; }
.item-source-link .arrow { display: inline-block; transform: translateX(2px); }
.item-source-url {
    margin-top: 0.25rem;
    font-size: 11px; color: #999;
    word-wrap: break-word; overflow-wrap: break-word;
}
.item-section-heading {
    font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em;
    color: #555; margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.25rem; border-bottom: 1px solid #eee;
}
.item-also-by ul,
.item-publisher-list {
    list-style: none; padding: 0; margin: 0;
}
.item-also-by li,
.item-publisher-row {
    padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0;
}
.item-also-by a { color: #2469b3; text-decoration: none; }
.item-also-by a:hover { text-decoration: underline; }
.item-publisher-row { display: flex; gap: 0.6rem; align-items: center; }
.item-publisher-thumb-link {
    flex: 0 0 56px;
    display: inline-flex; align-items: center; justify-content: center;
}
.item-publisher-thumb {
    display: inline-block;
    width: 56px; height: 56px;
    object-fit: cover; border-radius: 6px;
    /* Soft gradient placeholder so a missing-thumb row doesn't punch a hard
     * dark hole next to its neighbours. */
    background: linear-gradient(135deg, #f4f4f4 0%, #e8e8e8 100%);
    /* Suppress the broken-image alt-text flash before our onerror handler
     * drops the src. */
    font-size: 0; color: transparent;
}
.item-publisher-thumb-empty { /* same dimensions as the img variant */ }
.item-publisher-link {
    color: #1a1a1a; text-decoration: none; font-size: 14px;
}
.item-publisher-link:hover { text-decoration: underline; }

/* ─── Share modal ─────────────────────────────────────────── */
.share-modal {
    border: 0; border-radius: 8px;
    padding: 0; max-width: 90vw; width: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.share-modal::backdrop { background: rgba(0,0,0,.45); }
.share-modal-body { padding: 1rem 1.25rem 1.25rem; }
.share-modal-title { margin: 0 0 0.5rem; font-size: 18px; }
.share-modal-link {
    font-size: 14px; color: #555; margin-bottom: 0.75rem;
    word-wrap: break-word; overflow-wrap: break-word;
}
.share-modal-row { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.share-modal-url {
    flex: 1; min-width: 0;
    padding: 0.4rem 0.6rem;
    border: 1px solid #d0d0d0; border-radius: 4px;
    font-size: 13px; font-family: monospace;
}
.share-modal-actions { display: flex; justify-content: flex-end; gap: 0.4rem; }
.btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #d0d0d0; border-radius: 4px;
    background: #fff; color: #333;
    font-size: 13px; cursor: pointer;
}
.btn-primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-primary:hover { background: #333; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: #f5f5f5; }

/* ─── Related drawer (right-side slide-in) ────────────────── */
.related-drawer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.related-drawer[data-open] { pointer-events: auto; }
.related-drawer-scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0; transition: opacity 200ms ease;
}
.related-drawer[data-open] .related-drawer-scrim { opacity: 1; }
.related-drawer-pane {
    position: absolute; inset: 0 0 0 auto;
    width: min(88vw, 380px);
    background: #fff;
    transform: translateX(100%); transition: transform 220ms ease;
    display: flex; flex-direction: column;
    box-shadow: -2px 0 12px rgba(0,0,0,.25);
}
.related-drawer[data-open] .related-drawer-pane { transform: translateX(0); }
.related-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}
.related-drawer-title { margin: 0; font-size: 16px; }
.related-drawer-close {
    background: none; border: 0;
    font-size: 22px; line-height: 1; color: #555;
    padding: 0.25rem 0.5rem; cursor: pointer;
}
.related-drawer-close:hover { color: #1a1a1a; }
.related-drawer-body {
    flex: 1; overflow-y: auto;
    padding: 0.75rem 1rem;
}
.related-drawer-body .i-list-default-img,
.related-drawer-body .i-list-logo-img,
.related-drawer-body img {
    max-width: 100%;
}

/* ─── Loading / empty states reused across views ──────────── */
.view-loading, .view-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #999; font-size: 14px;
}

/* ─── Muxcode-embedded video iframes ─────────────────────────
 * Mirrors /misc/css/scss_25v4/components/_article.scss so the
 * iframe sizes responsively (16:9) inside the item body, matching
 * the legacy render.
 */
.muxcode-video-wrapper,
.muxcode-video-wrapper-bitchute,
.muxcode-video-wrapper-odysee {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;     /* 16:9 aspect */
    padding-top: 0;
    height: 0;
    margin: 0.75rem 0;
}
.muxcode-video-wrapper iframe,
.muxcode-video-wrapper-bitchute iframe,
.muxcode-video-wrapper-odysee iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
/* Generic iframe muxcode (used by [[iframe=…]]) — let it be the size set
 * by the inline width/height attrs; just don't let it exceed the column. */
.item-body iframe { max-width: 100%; }

/* ─── Filter row (under category pills, browse tab only) ────── */
.filter-row {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}
.filter-row[hidden] { display: none; }
.filter-btn {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid #d0d0d0; border-radius: 999px;
    background: #fff; color: #333;
    font-size: 12px; line-height: 1.4; cursor: pointer; white-space: nowrap;
}
.filter-btn:hover, .filter-btn:focus-visible {
    background: #1a1a1a; color: #fff; border-color: #1a1a1a; outline: none;
}
.filter-btn-icon { display: inline-flex; }
.filter-reset {
    background: none; border: 0; cursor: pointer;
    color: #888;
    font-size: 18px; line-height: 1;
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
}
.filter-reset:hover, .filter-reset:focus-visible {
    color: #1a1a1a; background: #f0f0f0; outline: none;
}
.filter-summary {
    flex: 1 1 auto; min-width: 0;
    font-size: 11px; color: #777;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filter-summary strong { font-weight: 600; color: #1a1a1a; }

/* ─── Sort & Filter tray (slides in from left) ──────────────── */
.filter-tray { position: fixed; inset: 0; z-index: 65; pointer-events: none; }
.filter-tray[data-open] { pointer-events: auto; }
.filter-tray-scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0; transition: opacity 200ms ease;
}
.filter-tray[data-open] .filter-tray-scrim { opacity: 1; }
.filter-tray-pane {
    position: absolute; inset: 0 auto 0 0;
    width: min(85vw, 360px);
    background: #fff;
    transform: translateX(-100%); transition: transform 220ms ease;
    display: flex; flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,.25);
}
.filter-tray[data-open] .filter-tray-pane { transform: translateX(0); }
.filter-tray-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}
.filter-tray-title { margin: 0; font-size: 16px; }
.filter-tray-close {
    background: none; border: 0;
    font-size: 22px; line-height: 1; color: #555;
    padding: 0.25rem 0.5rem; cursor: pointer;
}
.filter-tray-close:hover { color: #1a1a1a; }
.filter-tray-body { flex: 1; overflow-y: auto; padding: 1rem; }
.filter-tray-section { margin-bottom: 1.25rem; }
.filter-tray-section-heading {
    margin: 0 0 0.5rem;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
    color: #888; font-weight: 600;
}
.filter-sort-options { display: flex; flex-direction: column; gap: 0.2rem; }
.filter-sort-option {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.45rem 0.7rem; border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer; font-size: 14px;
}
.filter-sort-option:hover { background: #f5f5f5; }
.filter-sort-option.is-active {
    background: #1a1a1a; color: #fff; border-color: #1a1a1a;
}
.filter-sort-option input[type="radio"] { margin: 0; cursor: pointer; }
.filter-topic-current { display: flex; align-items: center; gap: 0.5rem; }
.filter-topic-chip {
    display: inline-flex; align-items: center;
    padding: 0.25rem 0.7rem;
    background: #f0f0f0; border-radius: 999px;
    font-size: 13px;
}
.filter-topic-empty { font-size: 13px; color: #888; }

/* ─── Infinite-scroll sentinel ──────────────────────────────── */
/* Placed at the end of an .iscr-container by browse.js. When it scrolls
 * into view the next /v1/listings page is fetched and inserted before it. */
.iscr-sentinel {
    padding: 1rem;
    text-align: center;
    color: #888;
    font-size: 13px;
    flex: 1 1 100%;
    width: 100%;
}
.iscr-sentinel.iscr-end { color: #b0b0b0; }

/* ─── Find view ──────────────────────────────────────────────── */
.find-wrap { padding: 0.5rem; }
.find-bar {
    display: flex; align-items: center; gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.find-reset {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    background: #fff;
    border: 1px solid #d0d0d0; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #555; font-size: 15px; line-height: 1; cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.find-reset:hover, .find-reset:focus-visible {
    background: #1a1a1a; color: #fff; border-color: #1a1a1a; outline: none;
}
.find-input {
    flex: 1 1 auto; min-width: 0;
    padding: 0.6rem;
    border: 1px solid #ccc; border-radius: 6px;
    font: inherit;
}
.find-input:focus { outline: 2px solid #1a73e8; outline-offset: 1px; }

/* ─── Sort & Filter tray — Min Rating ─────────────────────── */
.filter-min-rating { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-min-rating-slider {
    width: 100%;
    accent-color: #1a1a1a;
    cursor: pointer;
}
.filter-min-rating-scale {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #777;
}
.filter-min-rating-value {
    font-weight: 600; color: #1a1a1a;
    min-width: 4em; text-align: center;
}

/* ─── Page detail view (views/page.js) ─────────────────────────────
   Class names mirror the legacy /skins/25v4/page_*.tpl rendered HTML
   (see temp/priv.html). Bootstrap-style .row/.col classes are styled
   below — the SPA doesn't load Bootstrap, but the page view uses the
   same class names so the legacy markup ports straight in. */
.page-view {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem;
    background: #fff;
    border-radius: 6px;
    color: #1a1a1a;
    font-size: 15px;
    line-height: 1.55;
}
.page-view .row { display: block; margin-bottom: 0.5rem; }
.page-view .col, .page-view .col-12, .page-view .col-10 { display: block; }
.page-view #mux-center_column { width: 100%; }

.page-view .edit_in_acp { margin: 0 0 0.75rem; }
.page-view .edit_in_acp .btn {
    display: inline-block; padding: 0.2rem 0.6rem;
    font-size: 12px; line-height: 1.3;
    background: #f4f4f4; color: #333;
    border: 1px solid #d0d0d0; border-radius: 4px;
    text-decoration: none;
}
.page-view .edit_in_acp .btn:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

.page-view .mux-article-title h2 {
    font-size: 26px; font-weight: 700; line-height: 1.2;
    margin: 0 0 0.5rem; color: #1a1a1a;
}
.page-view .mux-article-subtitle h4 {
    font-size: 17px; font-weight: 500; color: #555;
    margin: 0 0 1rem;
}
.page-view .pg_main_image {
    display: block; width: 100%; max-width: 100%; height: auto;
    border-radius: 4px; margin: 0.5rem 0 1rem;
}

.page-view #page_info { margin: 0.5rem 0 1rem; }
.page-view .mux-article-info {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.5rem 0; border-top: 1px solid #ececec; border-bottom: 1px solid #ececec;
}
.page-view .mux-article-info-image { flex: 0 0 auto; }
.page-view .mux-article-info-image img { display: block; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.page-view .mux-article-info-box { flex: 1 1 auto; min-width: 0; }
.page-view .mux-article-info-author-name-container {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
}
.page-view .mux-article-info-author-name a {
    font-weight: 600; color: #1a1a1a; text-decoration: none; cursor: pointer;
}
.page-view .mux-article-info-author-name a:hover { text-decoration: underline; }
.page-view .mux-article-info-author-follow-button-box button {
    font-size: 12px; padding: 0.15rem 0.55rem; border-radius: 999px;
    border: 1px solid #1a1a1a; background: #fff; cursor: pointer;
}
.page-view .mux-article-info-author-follow-button-box button:hover { background: #1a1a1a; color: #fff; }
.page-view .mux-article-info-date { font-size: 13px; color: #777; }
.page-view .mux-article-info-date > div { display: inline; }

.page-view .mux-article-body {
    font-size: 15px; line-height: 1.65; color: #222;
    margin: 1rem 0;
    word-wrap: break-word; overflow-wrap: break-word;
}
.page-view .mux-article-body p { margin: 0 0 1em; }
.page-view .mux-article-body a { color: #2469b3; }
.page-view .mux-article-body h3,
.page-view .mux-article-body h4 {
    margin: 1.4em 0 0.5em; font-weight: 600; line-height: 1.3;
}
.page-view .mux-article-body h3 { font-size: 19px; }
.page-view .mux-article-body h4 { font-size: 16px; }
.page-view .mux-article-body ul,
.page-view .mux-article-body ol { margin: 0 0 1em 1.4em; padding: 0; }
.page-view .mux-article-body li  { margin: 0.25em 0; }
.page-view .mux-article-body img { max-width: 100%; height: auto; }
.page-view .mux-article-body blockquote {
    margin: 0.75rem 0;
    padding: 0.5rem 0.9rem;
    background: #f7f7f7; border-left: 3px solid #d0d0d0; border-radius: 4px;
    color: #444; font-style: italic;
}
.page-view .mux-article-body strike { color: #999; }

.page-view #page_attachment {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 1rem 0; padding: 0.6rem 0.8rem;
    background: #f7f7f7; border-radius: 4px;
}
.page-view #page_attachment .l1 { font-size: 18px; }
.page-view #page_attachment a { color: #2469b3; text-decoration: none; }
.page-view #page_attachment a:hover { text-decoration: underline; }

/* ─── Contact view (views/contact.js) ──────────────────────────── */
.contact-view {
    max-width: 620px; margin: 0 auto; padding: 1rem;
    background: #fff; border-radius: 6px;
    color: #1a1a1a; font-size: 15px; line-height: 1.5;
}
.contact-title { font-size: 22px; font-weight: 700; margin: 0 0 0.5rem; }
.contact-intro { color: #555; margin: 0 0 1rem; }
.contact-form { display: flex; flex-direction: column; gap: 0.75rem; }
.contact-row { display: flex; flex-direction: column; gap: 0.25rem; }
.contact-label { font-size: 13px; font-weight: 500; color: #444; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    padding: 0.5rem 0.65rem;
    border: 1px solid #d0d0d0; border-radius: 4px;
    font: inherit; color: #1a1a1a; background: #fff;
}
.contact-form input:focus,
.contact-form textarea:focus { outline: 2px solid #2469b3; outline-offset: 1px; border-color: #2469b3; }
.contact-form textarea { resize: vertical; min-height: 120px; line-height: 1.4; }

.contact-captcha-row {
    flex-direction: row; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap;
}
.contact-captcha-img {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: #f6f6f6; padding: 0.3rem; border-radius: 4px;
}
.contact-captcha-img img { display: block; max-height: 44px; }
.contact-captcha-refresh {
    background: transparent; border: 1px solid #d0d0d0; border-radius: 4px;
    padding: 0.2rem 0.45rem; cursor: pointer; font-size: 14px;
}
.contact-captcha-refresh:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.contact-captcha-input { flex: 1 1 200px; min-width: 200px; }
.contact-captcha-missing { color: #888; font-style: italic; }

.contact-actions { flex-direction: row; align-items: center; gap: 1rem; }
.contact-btn-submit {
    padding: 0.5rem 1.1rem;
    background: #1a1a1a; color: #fff;
    border: 1px solid #1a1a1a; border-radius: 4px;
    font: inherit; font-weight: 500; cursor: pointer;
}
.contact-btn-submit:hover { background: #333; border-color: #333; }
.contact-btn-submit:disabled { background: #aaa; border-color: #aaa; cursor: not-allowed; }
.contact-status { font-size: 13px; color: #555; }
.contact-status-ok  { color: #2c7a2c; }
.contact-status-err { color: #b3261e; }

/* ─── Publish view ──────────────────────────────────────────────────── */
.publish-view {
    max-width: 620px; margin: 0 auto;
    padding: 0.75rem 0.5rem 4rem;
    background: #fff; border-radius: 6px;
    color: #1a1a1a; font-size: 15px; line-height: 1.5;
}
.publish-view h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.publish-help {
    color: #555; font-size: 13px; line-height: 1.45;
    margin: 0 0 1rem;
}
.publish-dir-list {
    display: grid; gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.publish-dir-card {
    border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 0.75rem; background: #fff;
    display: flex; flex-direction: column; gap: 0.4rem;
}
.publish-dir-pick {
    width: 100%; padding: 0.55rem 0.75rem;
    background: #1a1a1a; color: #fff;
    border: 1px solid #1a1a1a; border-radius: 4px;
    font: inherit; font-weight: 600; cursor: pointer;
}
.publish-dir-pick:hover { background: #333; }
.publish-dir-desc { color: #555; font-size: 12px; line-height: 1.4; }

.publish-form-title {
    margin: 0.5rem 0 0.75rem; font-size: 1.2rem;
}
.publish-dir-name { color: #1a73e8; }
.publish-form {
    display: flex; flex-direction: column; gap: 0.75rem;
}
.publish-field {
    display: flex; flex-direction: column; gap: 0.3rem;
}
.publish-label {
    font-size: 13px; font-weight: 600; color: #333;
}
.publish-form input[type=text],
.publish-form input[type=url],
.publish-form input[type=email],
.publish-form input[type=number],
.publish-form input[type=date],
.publish-form input[type=time],
.publish-form select,
.publish-form textarea {
    width: 100%; box-sizing: border-box;
    padding: 0.45rem 0.55rem;
    border: 1px solid #d0d0d0; border-radius: 4px;
    background: #fff; color: #1a1a1a;
    font: inherit;
}
.publish-form textarea { resize: vertical; min-height: 60px; line-height: 1.4; }
.publish-form select:focus,
.publish-form input:focus,
.publish-form textarea:focus { outline: 2px solid #2469b3; outline-offset: 1px; }

.publish-tags, .publish-cfs {
    border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 0.5rem 0.75rem 0.75rem;
}
.publish-tags legend, .publish-cfs legend {
    padding: 0 0.35rem; font-size: 13px; font-weight: 600; color: #333;
}
.publish-tag-grid {
    display: grid; gap: 0.3rem 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    font-size: 13px;
}
.publish-tag { display: flex; align-items: center; gap: 0.4rem; }
.publish-cf-grid {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.publish-cf { display: flex; flex-direction: column; gap: 0.25rem; }
.publish-cf-title { font-size: 13px; color: #444; }
.publish-cf-div { padding-top: 0.5rem; }
.publish-cf-div h4 {
    margin: 0; font-size: 0.95rem; color: #1a1a1a;
    border-bottom: 1px solid #e0e0e0; padding-bottom: 0.25rem;
}
.publish-cf-multi {
    display: grid; gap: 0.25rem 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    font-size: 13px;
}
.publish-cf-multi-opt { display: flex; align-items: center; gap: 0.35rem; }

.publish-actions {
    display: flex; justify-content: center; padding: 0.5rem 0;
}
.publish-actions .btn-primary[disabled] {
    background: #aaa; border-color: #aaa; cursor: not-allowed;
}
.publish-error {
    background: #fbeaea; color: #b3261e;
    border: 1px solid #f0c0c0; border-radius: 4px;
    padding: 0.5rem 0.75rem; font-size: 13px;
}

/* Summernote inside the SPA — confine the editor's width to the form
   column and let its own styles handle the toolbar / note-editor surface.
   No Bootstrap loaded → modal dialogs (link/help) render unstyled but
   functional. */
.publish-form .note-editor { width: 100%; }

/* ─── Wide-viewport layout (>= 650px) ────────────────────────────────────
   Phone styling (the rules above) is the default. From 650px up we add a
   vertical left side-nav and (>= 1080px) a right column. Bottom-nav is
   hidden once side-nav becomes available. Breakpoints:
     <  650px           phone: bottom-nav only
     >= 650px           tablet: side-nav icons + tooltips
     >= 1080px          tablet-wide: side-nav + right column
     >= 1280px          desktop: side-nav icons + labels + right column
*/
.side-nav, .right-col { display: none; }   /* hidden by default (phone) */

@media (min-width: 650px) {
    .bottom-nav { display: none; }
    body { padding-left: 56px; padding-bottom: 0; }

    .side-nav {
        position: fixed; top: 52px; bottom: 0; left: 0;
        width: 56px;
        display: flex; flex-direction: column;
        padding: 0.5rem 0;
        background: #fff;
        border-right: 1px solid #eee;
        z-index: 30;
        overflow-y: auto;
    }
    .sn-item {
        display: flex; align-items: center; gap: 0.65rem;
        padding: 0.7rem 0.85rem;
        background: none; border: 0; cursor: pointer;
        color: #1a1a1a; font: inherit;
        white-space: nowrap; position: relative;
    }
    .sn-item:hover { background: #f0f0f0; }
    .sn-item[data-active] {
        background: #e8f0fb; color: #1a73e8; font-weight: 600;
    }
    .sn-item[hidden] { display: none; }
    .sn-icon { font-size: 22px; flex-shrink: 0;
        display: inline-flex; align-items: center; justify-content: center;
        line-height: 1; }
    .sn-label { display: none; }
    .sn-divider {
        height: 1px; background: #eee; margin: 0.4rem 0.5rem;
    }
    .sn-divider[hidden] { display: none; }

    /* Tooltip on hover for icon-only mode. Hidden when label is visible
       (>= 1280px override below). */
    .sn-item::after {
        content: attr(data-tip);
        position: absolute; left: 100%; top: 50%;
        transform: translateY(-50%) translateX(0.4rem);
        background: #1a1a1a; color: #fff;
        padding: 0.25rem 0.55rem; border-radius: 4px;
        font-size: 12px; white-space: nowrap;
        opacity: 0; pointer-events: none;
        transition: opacity 120ms ease 100ms;
        z-index: 100;
    }
    .sn-item:hover::after { opacity: 1; }

    /* Publish button — icon-only badge styling at this breakpoint. The
       glyph is a plain ASCII `+` (not the heavy-plus emoji ➕ which the
       OS emoji font would render in its own colour, ignoring CSS).
       font-weight pushes the `+` to read as heavy. */
    .sn-publish .sn-icon {
        background: #1a73e8; color: #fff;
        width: 32px; height: 32px;
        border-radius: 50%;
        font-size: 22px; font-weight: 700; line-height: 1;
    }
    .sn-publish:hover { background: transparent; }
    .sn-publish:hover .sn-icon { background: #1558b8; }
}

@media (min-width: 1080px) {
    body { padding-right: 320px; }

    .right-col {
        position: fixed; top: 52px; bottom: 0; right: 0;
        width: 320px;
        display: block;
        padding: 1rem;
        background: #fff; border-left: 1px solid #eee;
        z-index: 30;
        overflow-y: auto;
    }
    .rc-section + .rc-section { margin-top: 1.4rem; }
    .rc-section-title {
        margin: 0 0 0.55rem;
        font-size: 13px; font-weight: 700; color: #555;
        letter-spacing: 0.04em; text-transform: uppercase;
    }
    .rc-find-form { display: flex; gap: 0.3rem; }
    .rc-find-input {
        flex: 1; min-width: 0;
        padding: 0.45rem 0.6rem;
        border: 1px solid #d0d0d0; border-radius: 4px;
        background: #fff; color: #1a1a1a;
        font: inherit; font-size: 13px;
    }
    .rc-find-input:focus { outline: 2px solid #2469b3; outline-offset: 1px; }
    .rc-find-submit {
        background: #1a1a1a; color: #fff; border: 0;
        padding: 0.4rem 0.7rem; border-radius: 4px;
        cursor: pointer; font-size: 14px;
    }
    .rc-find-submit:hover { background: #333; }

    .rc-auth-blurb {
        margin: 0 0 0.55rem;
        font-size: 13px; line-height: 1.4; color: #555;
    }
    .rc-auth .btn { display: block; width: 100%; margin: 0.3rem 0; }

    .rc-module { font-size: 13px; }
    .rc-loading {
        padding: 0.5rem 0; color: #888; font-size: 12px;
    }
    .rc-empty {
        padding: 0.5rem 0; color: #999; font-size: 12px; font-style: italic;
    }
    .rc-module-item {
        display: block; padding: 0.45rem 0;
        border-top: 1px solid #f0f0f0;
        color: #1a1a1a; text-decoration: none;
        font-size: 13px; line-height: 1.35;
    }
    .rc-module-item:first-child { border-top: 0; }
    .rc-module-item:hover { color: #1a73e8; }
}

@media (min-width: 1280px) {
    body { padding-left: 200px; }

    .side-nav { width: 200px; padding: 0.5rem; }
    /* Keep vertical padding matching the icon-only mode so item height
       stays the same across breakpoints — only the rounded corners and
       label visibility differ. */
    .sn-item { border-radius: 6px; }
    .sn-label { display: inline; font-size: 14px; }
    .sn-item::after { display: none; }   /* tooltip not needed alongside label */

    .sn-publish {
        background: #1a73e8; color: #fff;
        justify-content: flex-start;
        margin: 0.4rem 0;
        font-weight: 600;
    }
    .sn-publish:hover { background: #1558b8; }
    /* Active state: darker blue background AND explicit white text.
       Without the color, .sn-item[data-active]'s color:#1a73e8 wins
       (same specificity, defined earlier) and the label turns blue. */
    .sn-publish[data-active] { background: #1558b8; color: #fff; }
    .sn-publish .sn-icon {
        background: transparent; width: auto; height: auto;
        border-radius: 0;
        font-size: 20px; font-weight: 700; line-height: 1;
    }
}

/* ── Ask-AI options picker (ui/ai-options-modal.js) ─────────────────────────── */
.ai-opt-body { display: flex; flex-direction: column; gap: .6rem; }
.ai-opt-card {
    border: 1px solid #333; border-radius: 8px; padding: .7rem .8rem; background: #161b22;
    cursor: pointer; transition: border-color .12s, background .12s;
}
.ai-opt-card:hover { border-color: #4a5b6a; background: #1a2230; }
.ai-opt-card.is-selected { border-color: #33aa77; box-shadow: 0 0 0 1px #33aa77 inset; }
.ai-opt-card.is-locked { opacity: .72; cursor: not-allowed; }
.ai-opt-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ai-opt-label { font-weight: 600; color: #e6edf3; }
.ai-opt-current { color: #3a7; font-size: .72rem; white-space: nowrap; }
.ai-opt-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .35rem 0; }
.ai-chip { font-size: .68rem; padding: .1rem .4rem; border-radius: 10px; background: #26333f; color: #bcd; }
.ai-chip-free, .ai-chip-fast, .ai-chip-high { background: #17402a; color: #7fe0a8; }
.ai-chip-premium, .ai-chip-slow { background: #4a2b2b; color: #f3b3b3; }
.ai-opt-desc { font-size: .82rem; color: #adbac7; line-height: 1.4; }
.ai-opt-desc p { margin: .25rem 0; }
.ai-opt-desc code { background: #0d1117; padding: 0 .25rem; border-radius: 3px; }
.ai-opt-desc ul { margin: .25rem 0 .25rem 1.1rem; padding: 0; }
.ai-opt-mcp { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.ai-mcp-badge {
    font-size: .7rem; padding: .12rem .45rem; border-radius: 10px;
    background: #1e2f45; color: #8fdcff; border: 1px solid #2a4560; cursor: help;
}
.ai-opt-gate { margin-top: .45rem; font-size: .74rem; color: #e0a878; }
