/* flatbb — core stylesheet. Everything is driven by the CSS variables below.
 * Plugins and themes override variables; see docs/THEME.md. Component tokens (--card-bg, --btn-radius, --row-pad…)
 * are not defined here: rules read them as var(--card-bg, var(--panel)), so the fallback is the default look. */

:root {
  --brand: #e7672e; --brand-hover: #cf5722; --brand-soft: #fdeee6; --brand-text: #fff;
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f7f8fa; --line: #e4e7ec; --line-soft: #eef0f3; --hover: #f2f4f7;
  --text: #171b21; --text-muted: #5b6472; --text-subtle: #878e99; --text-disabled: #b9c0ca;
  --success: #16a34a; --success-soft: #dcfce7; --danger: #dc2626; --danger-soft: #fee2e2;
  --warning: #d97706; --warning-soft: #fef3c7; --info: #2563eb; --info-soft: #dbeafe;
  --backdrop: rgba(15, 18, 24, .5); --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05); --shadow-md: 0 12px 32px rgba(16, 24, 40, .14);
  --radius: 10px; --radius-sm: 7px; --radius-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-size-xs: 11px; --font-size-sm: 12px; --font-size-md: 14px; --font-size-lg: 16px; --font-size-xl: 18px; --font-size-2xl: 22px; --font-size-3xl: 26px;
  --topbar-h: 56px; --left-w: 220px; --right-w: 280px; --gap: 24px; --container: 1280px;
  --page-x: 20px; /* the page's side margin: 20px, 16px on tablets, 12px on phones. Everything lines up on it; a strip that runs
                     edge to edge (the category bar, a notice bar) pulls out by exactly this much: margin-inline: calc(-1 * var(--page-x)) */
  color-scheme: light;
}
[data-theme="dark"] { --bg: #0f1216; --panel: #171b20; --panel-2: #1e232a; --line: #2b3139; --line-soft: #242a31; --hover: #1c2128; --text: #e6e8eb; --text-muted: #9aa4b2; --text-subtle: #6b7482; --text-disabled: #4a525e; --brand-soft: rgba(231, 103, 46, .16); --success-soft: rgba(22, 163, 74, .18); --danger-soft: rgba(220, 38, 38, .18); --warning-soft: rgba(217, 119, 6, .18); --info-soft: rgba(37, 99, 235, .18); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 24px rgba(0, 0, 0, .5); color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] { --bg: #0f1216; --panel: #171b20; --panel-2: #1e232a; --line: #2b3139; --line-soft: #242a31; --hover: #1c2128; --text: #e6e8eb; --text-muted: #9aa4b2; --text-subtle: #6b7482; --text-disabled: #4a525e; --brand-soft: rgba(231, 103, 46, .16); --success-soft: rgba(22, 163, 74, .18); --danger-soft: rgba(220, 38, 38, .18); --warning-soft: rgba(217, 119, 6, .18); --info-soft: rgba(37, 99, 235, .18); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 24px rgba(0, 0, 0, .5); color-scheme: dark; }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--font-size-md)/var(--line-height, 1.55) var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--brand); text-decoration: none; transition: color .12s; }
a:hover { color: var(--brand-hover); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: var(--heading-weight, 650); }
h1 { font-size: var(--font-size-2xl); letter-spacing: -.01em; } h2 { font-size: var(--font-size-xl); } h3 { font-size: var(--font-size-lg); } h4 { font-size: var(--font-size-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 4px; padding: .1em .35em; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; }
pre code { background: none; border: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
small, .small { font-size: var(--font-size-sm); }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--page-x); }
.code-row { display: flex; gap: 8px; } .code-row input { flex: 1; min-width: 0; } .code-row .btn { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--brand); color: #fff; font-size: var(--font-size-xs); font-weight: 600; line-height: 1; }
.flag { display: inline-block; padding: 1px 7px; border-radius: var(--flag-radius, 4px); background: var(--brand-soft); color: var(--brand); font-size: var(--font-size-xs); font-weight: 600; vertical-align: middle; }
.flag-danger { background: var(--danger-soft); color: var(--danger); }
.flag-pending { display: inline-flex; align-items: center; gap: 3px; background: var(--warning-soft); color: var(--warning); }
.flag-pending .icon { width: 12px; height: 12px; }
.flag-success { background: var(--success-soft); color: var(--success); }
.flag-warning { background: var(--warning-soft); color: var(--warning); }
.flag-muted { background: var(--panel-2); color: var(--text-muted); font-weight: 500; }
.admin-ai-conn { margin-bottom: 14px; }
.admin-ai-conn .card-head .flag { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 56px 16px; color: var(--text-subtle); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .icon { width: 40px; height: 40px; opacity: .45; margin-bottom: 6px; }
mark { background: var(--warning-soft); color: inherit; border-radius: 2px; padding: 0 2px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: var(--btn-pad, 7px 14px); border: 1px solid var(--line); border-radius: var(--btn-radius, var(--radius-sm)); background: var(--panel); color: var(--text); font: inherit; font-weight: var(--btn-weight, 550); cursor: pointer; line-height: 1.3; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: var(--text-subtle); color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-text); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: var(--font-size-sm); }
.btn-lg { padding: 10px 22px; font-size: var(--font-size-lg); }
.btn-block { width: 100%; justify-content: center; }
.btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn .badge { position: absolute; top: 3px; inset-inline-end: 3px; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="file"], select, textarea { width: 100%; padding: var(--input-pad, 9px 11px); border: 1px solid var(--line); border-radius: var(--input-radius, var(--radius-sm)); background: var(--input-bg, var(--panel)); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--panel) inset; -webkit-text-fill-color: var(--text); }
textarea { resize: vertical; min-height: 80px; }
input[type="color"] { width: 48px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.input-lg { font-size: var(--font-size-xl); padding: 10px 12px; }
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; font-weight: 600; margin-bottom: 5px; font-size: var(--font-size-sm); }
.form-help { color: var(--text-muted); font-size: var(--font-size-sm); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.composer .form-actions, .page-compose .form-actions { justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: auto; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.hp { position: absolute; inset-inline-start: -9999px; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; background: var(--info-soft); color: var(--info); font-weight: 500; transition: opacity .4s; }
.flash-success { background: var(--success-soft); color: var(--success); }
.admin-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); font-size: var(--font-size-sm); }
.admin-note > .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--info); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); font-weight: 400; }
.flash-warning ul { margin: 6px 0 0; padding-inline-start: 20px; }
.flash.fade { opacity: 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-md); opacity: 0; transition: all .25s; z-index: 200; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); color: #fff; }
.toast:has(.toast-action) { display: flex; align-items: center; gap: 14px; }
.toast-action { padding: 2px 4px; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
/* picture fields (image_field()): the picture, Upload / Replace and Remove; saved keys (secret_field()) */
.image-field { display: flex; align-items: center; gap: 14px; }
.image-field-thumb { display: flex; flex: none; align-items: center; justify-content: center; width: 64px; height: 64px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-muted); }
.image-field.wide .image-field-thumb { width: 150px; }
.image-field.round .image-field-thumb { width: 72px; height: 72px; border-radius: 12px; }
.image-field.round .image-field-thumb .avatar { width: 100%; height: 100%; }
.image-field.is-empty .image-field-thumb { border-style: dashed; }
.image-field-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-field.round .image-field-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-field-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.image-field-btns label.btn { position: relative; cursor: pointer; }
.image-field-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.image-field-btns label.btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.image-field .if-replace, .image-field.is-empty .if-upload + .if-replace { display: none; }
.image-field:not(.is-empty) .if-upload { display: none; }
.image-field:not(.is-empty) .if-replace { display: inline; }
.image-field.is-empty .if-remove { display: none; }
.image-field.is-busy, .secret-field.is-busy { opacity: .6; pointer-events: none; }
.btn.danger, .btn-ghost.danger { color: var(--danger); }
.secret-field .secret-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); font-size: var(--font-size-sm); }
.secret-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--success); }
.secret-btns { display: flex; gap: 6px; margin-inline-start: auto; }
.secret-input { display: flex; align-items: center; gap: 8px; }
.secret-input input { flex: 1; min-width: 0; }
.secret-field:not(.is-empty):not(.is-changing) .secret-input, .secret-field.is-empty .secret-saved, .secret-field.is-changing .secret-saved, .secret-field.is-empty [data-secret-cancel] { display: none; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--topbar-bg, var(--panel)); border-bottom: 1px solid var(--topbar-line, var(--line)); height: var(--topbar-h); }
/* a frosted strip while the page scrolls under it; a theme that wants a solid bar simply overrides the background */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: color-mix(in srgb, var(--topbar-bg, var(--panel)) 80%, transparent); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); }
}
.topbar-inner { display: flex; align-items: center; gap: 8px; height: 100%; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: var(--font-size-lg); margin-inline-end: 12px; }
.logo img { height: 32px; width: auto; }
.logo-mark { display: block; flex: none; }
.logo img.logo-icon { width: 28px; height: 28px; flex: none; object-fit: contain; }
/* the full logo: its dark version on dark themes; on phones the icon takes its place when there is one */
.logo-img-dark, .logo-phone { display: none; }
[data-theme="dark"] .logo-img.has-dark { display: none; }
[data-theme="dark"] .logo-img-dark { display: block; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .logo-img.has-dark { display: none; } [data-theme="auto"] .logo-img-dark { display: block; } }
.topnav { display: flex; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; }
.topnav a .icon { width: 16px; height: 16px; opacity: .8; }
.topnav a:hover, .topnav a.active { background: var(--panel-2); color: var(--text); }
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.search-form { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0 12px; height: 36px; width: 220px; color: var(--text-subtle); margin-inline-end: 6px; }
.search-form input { border: 0; background: none; padding: 0; height: 100%; }
.search-form input:focus { outline: 0; }
.search-form:focus-within { border-color: var(--brand); background: var(--panel); }
.search-toggle { display: none; }
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: block; } [data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .theme-sun { display: block; } [data-theme="auto"] .theme-moon { display: none; } }
.drawer-toggle { display: none; }
.dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 2px; cursor: pointer; font: inherit; color: inherit; border-radius: var(--radius-pill); }
.dropdown-menu { display: none; position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu.floating { display: block; position: absolute; top: 0; inset-inline: auto; margin: 0; }
.dropdown-menu a, .dropdown-menu button, .dropdown-menu select { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--hover); }
.dropdown-menu button.danger { color: var(--danger); }
.dropdown-menu form { margin: 0; }
.lang-menu .dropdown-toggle { width: 36px; height: 36px; padding: 0; }
.lang-menu .dropdown-menu { min-width: 150px; }
.dropdown-menu button.active { color: var(--brand); font-weight: 600; }
/* Settings → Email: the address and its state, then the steps (verify it; change it) */
.email-now { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.email-now-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--panel); color: var(--text-muted); }
.email-now-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.email-now-main b { overflow-wrap: anywhere; font-size: var(--font-size-lg); }
.email-badge { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--warning, #d97706) 14%, transparent); color: var(--warning, #b45309); font-size: var(--font-size-sm); font-weight: 600; }
.email-badge.ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.email-badge .icon { width: 14px; height: 14px; }
.email-step { margin-top: 14px; }
.email-step-lead { margin: 0 0 10px; color: var(--text-muted); }
.email-change { margin-top: 16px; }
.email-change > summary { list-style: none; display: inline-flex; }
.email-change > summary::-webkit-details-marker { display: none; }
.email-change[open] > summary { display: none; }
.email-change .email-step { margin-top: 0; padding-top: 4px; }
.email-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.email-line span { overflow-wrap: anywhere; }
/* theme and language on phones (quick_prefs_html): two round buttons beside the name in the account menu, or at the top of a
   visitor's drawer; the second opens a row of languages under them. Hidden on wider screens, where the header has both */
.um-top { display: flex; align-items: center; gap: 6px; }
.um-top .um-head { flex: 1; min-width: 0; }
.quick-prefs, .drawer-quick { display: none; }
.quick-prefs { align-items: center; gap: 6px; flex: none; }
.qp-btn, .dropdown-menu .qp-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--text-muted); cursor: pointer; }
.qp-btn:hover, .dropdown-menu .qp-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--text-subtle); }
.qp-btn .icon { width: 17px; height: 17px; }
.qp-btn[aria-expanded="true"] { border-color: var(--brand); color: var(--brand); }
.qp-langs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 2px 8px 10px; }
.qp-langs[hidden] { display: none; }
.qp-langs button, .dropdown-menu .qp-langs button { width: auto; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: var(--font-size-sm); }
.qp-langs button.active, .dropdown-menu .qp-langs button.active { border-color: transparent; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.drawer-quick { align-items: center; justify-content: space-between; margin-bottom: 14px; padding: 0 4px 12px; border-bottom: 1px solid var(--line-soft); }
.col-left > .qp-langs { margin: -6px 0 12px; padding: 0 4px 12px; border-bottom: 1px solid var(--line-soft); }
/* account menu: who is signed in, their numbers, then the menu in groups */
.user-menu .dropdown-menu { min-width: 250px; }
.dropdown-menu a.um-head { gap: 10px; padding: 8px; }
.um-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.um-id b { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.um-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.um-labels:empty { display: none; }
.um-actions { display: flex; flex-direction: column; gap: 6px; margin: 2px 4px 6px; }
.um-actions form { margin: 0; }
.dropdown-menu .um-action { justify-content: center; gap: 6px; padding: 9px 10px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dropdown-menu .um-action:hover { background: color-mix(in srgb, var(--brand) 18%, var(--panel)); }
.dropdown-menu .um-action .icon { color: currentColor; }
.dropdown-menu .um-action.is-done { background: var(--success-soft); color: var(--success); font-weight: 500; }
.um-action .me-count { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.um-stats { display: flex; margin: 2px 4px 6px; border-radius: var(--radius-sm); background: var(--panel-2); }
.dropdown-menu .um-stats a { flex: 1; flex-direction: column; gap: 0; min-width: 0; padding: 6px 4px; text-align: center; }
.dropdown-menu .um-stats a:hover { background: var(--brand-soft); }
.um-stats b { font-size: var(--font-size-md); line-height: 1.25; }
.um-stats span { color: var(--text-muted); font-size: var(--font-size-xs); }
.um-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.um-group .icon { color: var(--text-muted); }
.um-count { margin-inline-start: auto; padding: 0 7px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-size: var(--font-size-xs); font-weight: 600; line-height: 1.6; }
.dropdown-head { padding: 6px 10px; font-weight: 600; color: var(--text-muted); font-size: var(--font-size-sm); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }

/* ---------- a native <select> drawn as the site's own dropdown (app.js) ----------
 * .fb-select wraps the real <select>; the read-only view is the button, the menu is our list. The native select stays
 * in the form (invisible) so its value is still sent and the browser still enforces `required`, and shows again if the
 * script never runs. */
.fb-select { position: relative; display: block; width: 100%; }
.fb-select-native { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.fb-select-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: var(--input-pad, 9px 11px); border: 1px solid var(--line); border-radius: var(--input-radius, var(--radius-sm)); background: var(--input-bg, var(--panel)); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.fb-select-btn:hover { border-color: var(--text-subtle); }
.fb-select-btn:focus-visible, .fb-select.open .fb-select-btn { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.fb-select-btn:disabled { cursor: default; opacity: .6; background: var(--panel-2); }
.fb-select-value { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fb-select-value.is-placeholder { color: var(--text-muted); }
.fb-select-caret { flex: none; width: 16px; height: 16px; color: var(--text-muted); transition: transform .15s; }
.fb-select.open .fb-select-caret { transform: rotate(180deg); }
.fb-select-menu { position: absolute; z-index: 70; inset-inline: 0; top: calc(100% + 4px); max-height: 264px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.fb-select-menu[hidden] { display: none; }
.fb-select-menu.floating { position: absolute; inset-inline: auto; z-index: 200; } /* hangs from <body>, so it must clear the admin drawer (120) and its backdrop (110) */
.fb-select-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.fb-select-opt:hover, .fb-select-opt:focus, .fb-select-opt.is-active { background: var(--hover); outline: none; }
.fb-select-opt.is-selected { color: var(--brand); font-weight: 600; }
.fb-select-opt[disabled] { color: var(--text-disabled); cursor: default; }
.fb-select-opt[disabled]:hover, .fb-select-opt[disabled]:focus { background: none; }
.fb-select-check { flex: none; width: 15px; height: 15px; visibility: hidden; }
.fb-select-opt.is-selected .fb-select-check { visibility: visible; }
.fb-select-opt-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fb-select.is-invalid .fb-select-btn { border-color: var(--danger); }

/* ---------- invalid fields: our own quiet line, never the browser's yellow bubble (app.js) ---------- */
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }
.fb-file.is-invalid .fb-file-btn { border-color: var(--danger); }
.form-error { margin-top: 5px; color: color-mix(in srgb, var(--danger) 72%, var(--text-muted)); font-size: var(--font-size-sm); line-height: 1.4; }

/* ---------- a native file input drawn as the site's own control (app.js) ----------
 * .fb-file wraps the real <input type=file>; it stays in the form (invisible) so the file is still sent. The reader
 * presses our button and the picked names show as chips. */
.fb-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-file > .fb-file-native { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.fb-file-btn { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: var(--input-pad, 9px 11px); border: 1px solid var(--line); border-radius: var(--input-radius, var(--radius-sm)); background: var(--input-bg, var(--panel)); color: var(--text); font: inherit; cursor: pointer; }
.fb-file-btn:hover { background: var(--panel-2); border-color: var(--text-subtle); }
.fb-file-btn:focus-visible { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.fb-file-icon { flex: none; width: 17px; height: 17px; color: var(--brand); }
.fb-file-list { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.fb-file-empty { color: var(--text-muted); font-size: var(--font-size-sm); }
.fb-file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 6px 3px 9px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--panel-2); font-size: var(--font-size-sm); }
.fb-file-name { max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fb-file-size { color: var(--text-muted); font-size: var(--font-size-xs); }
.fb-file-remove { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; }
.fb-file-remove:hover { background: var(--line); color: var(--text); }
.fb-file-x { width: 12px; height: 12px; }

/* ---------- three-column grid ---------- */
.page-grid { display: grid; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); gap: var(--gap); padding-top: 20px; padding-bottom: 40px; flex: 1; align-items: start; }
body.no-left .page-grid { grid-template-columns: minmax(0, 1fr) var(--right-w); }
body.no-right .page-grid { grid-template-columns: var(--left-w) minmax(0, 1fr); }
body.no-left.no-right .page-grid { grid-template-columns: minmax(0, 1fr); max-width: 900px; }
.col-left { position: sticky; top: calc(var(--topbar-h) + 20px); }
/* the right column follows the page the way X does (app.js moves --right-top): it scrolls until its last card shows, then stays;
   scrolling back up brings its top back. Shorter than the window, it simply stays under the top bar. Setting right_follow */
@media (min-width: 1201px) { body.right-follow .col-right { position: sticky; top: var(--right-top, calc(var(--topbar-h) + 20px)); } }
@media (min-width: 993px) { .page-admin .col-left { max-height: calc(100vh - var(--topbar-h) - 20px); overflow-y: auto; scrollbar-width: thin; padding-bottom: 20px; } } /* a long admin menu scrolls on its own; app.js keeps its position between pages */
.col-main { min-width: 0; }
.region:empty { display: none; }
.side-nav, .side-section { margin-bottom: 18px; }
.drawer-nav { display: none; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); } /* header.nav links, shown inside the mobile drawer only */
.side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--side-link-radius, var(--radius-sm)); color: var(--text-muted); font-weight: 500; transition: background .12s, color .12s; }
.side-group { margin: 14px 10px 4px; color: var(--text-subtle); font-size: var(--font-size-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.side-more > summary { list-style: none; cursor: pointer; color: var(--text-muted); }
.side-more > summary::-webkit-details-marker { display: none; }
.side-more[open] > summary { display: none; }
.side-link .icon { width: 18px; height: 18px; }
.side-link:hover { background: var(--panel); color: var(--text); }
.side-link.active { background: var(--side-link-active-bg, var(--brand-soft)); color: var(--side-link-active-text, var(--brand)); }
.side-link small { margin-inline-start: auto; color: var(--text-subtle); font-size: var(--font-size-xs); }
.side-section h4 { padding: 0 10px; margin-bottom: 6px; }
.cat-child { padding-inline-start: 26px; }
.card-tags .tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.card-stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card-bg, var(--panel)); border: 1px solid var(--card-line, var(--line)); border-radius: var(--card-radius, var(--radius)); box-shadow: var(--card-shadow, none); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: var(--card-head-pad, 12px 16px); border-bottom: 1px solid var(--line-soft); }
.card-head h3 { margin: 0; font-size: var(--font-size-md); }
.card-body { padding: var(--card-pad, 16px); }
.card-body > :last-child { margin-bottom: 0; }
/* the member card: head, number tiles (as many as fit a row), progress bars across the card, then the buttons (member.* regions) */
.me-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.me-id { min-width: 0; }
.me-id strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 1px; font-size: var(--font-size-sm); color: var(--text-muted); }
.me-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 4px; margin-bottom: 10px; }
.me-stats > * { min-width: 0; text-align: center; background: var(--panel-2); border-radius: var(--radius-sm); padding: 5px 2px; color: var(--text); }
.me-stats a:hover { background: var(--brand-soft); text-decoration: none; }
.me-stats b { display: block; font-size: var(--font-size-md); line-height: 1.3; }
.me-stats span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-xs); color: var(--text-muted); }
.me-bar { display: block; margin: -2px 0 10px; color: var(--text); }
.me-bar:hover { text-decoration: none; }
.me-bar-top { display: flex; align-items: baseline; gap: 6px; font-size: var(--font-size-sm); }
.me-bar-top span { color: var(--text-muted); }
.me-bar-top small { margin-inline-start: auto; color: var(--text-muted); font-size: var(--font-size-xs); white-space: nowrap; }
.me-bar-track { display: block; height: 5px; margin-top: 4px; border-radius: 3px; background: var(--line); overflow: hidden; }
.me-bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.me-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: -2px 0 12px; color: var(--text-muted); font-size: var(--font-size-sm); }
.me-foot .icon { width: 14px; height: 14px; }
.card-body > .me-foot:last-child { margin-bottom: 0; }
.me-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; margin: -4px 0 10px; }
.me-links > a { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 6px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--font-size-sm); }
.me-links > a:hover { background: var(--hover); text-decoration: none; }
.me-links .icon { flex: none; width: 16px; height: 16px; color: var(--text-muted); }
.me-links span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.me-links .me-count { margin-inline-start: auto; }
.me-actions { display: flex; flex-direction: column; gap: 8px; }
.menu-item-label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.menu-item-label .icon { width: 16px; height: 16px; color: var(--text-muted); }
.me-more { display: flex; gap: 6px; }
.me-more .btn { flex: 1 1 0; min-width: 0; justify-content: center; }
.me-more .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-count { min-width: 16px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--brand); color: var(--brand-text); font-size: var(--font-size-xs); line-height: 16px; text-align: center; }
/* wide screens: the member card beside the list carries New Topic, so the list head keeps the row for its tabs */
@media (min-width: 1201px) { body:has(.col-right .card-me [data-action="new"]) .list-new-topic { display: none; } }
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.stat-list li:last-child { border: 0; }
/* newest members card: 4 per row, rounded-square avatar with the name underneath */
.newest-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 4px; }
.newest-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; color: var(--text); font-size: var(--font-size-xs); text-decoration: none; }
.newest-item .avatar { border-radius: 8px; }
.newest-item .online-dot { width: 11px; height: 11px; top: -2px; left: -2px; }
.newest-item .verified-corner { width: 15px; height: 15px; inset-inline-end: -3px; bottom: -3px; }
.newest-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.newest-item:hover span { color: var(--brand); }
.link-list { list-style: none; margin: 0; padding: 6px 0; }
.link-list li { padding: 7px 16px; }
.link-list li a { color: var(--text); display: block; }
.link-list li small { color: var(--text-subtle); }
.layout-block { margin-bottom: 16px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--font-size-sm); color: var(--text-subtle); margin-bottom: 10px; }

/* ---------- avatars ---------- */
.avatar { width: var(--s, 32px); height: var(--s, 32px); border-radius: var(--avatar-radius, 6px); object-fit: cover; display: inline-block; vertical-align: middle; flex: none; }
.avatar-letter { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: calc(var(--s, 32px) * .44); line-height: 1; background: hsl(var(--hue, 20) 42% 46%); }
.avatar-link { display: inline-flex; position: relative; } /* holds the online dot and a plugin's corner mark (user.avatar_after) */
.avatar-online { position: relative; }
.online-dot { position: absolute; top: -1px; left: -1px; width: clamp(8px, calc(var(--s, 32px) * .22), 13px); height: clamp(8px, calc(var(--s, 32px) * .22), 13px); border-radius: 3px; background: #22c55e; border: 2px solid var(--panel); box-sizing: border-box; pointer-events: none; }
.user-link { color: var(--text); font-weight: 600; }
.user-link:hover { color: var(--brand); }

/* ---------- tabs & list head ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.list-head > * { min-width: 0; max-width: 100%; }
.tabs { display: flex; gap: 2px; background: none; border: 0; padding: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: var(--tab-pad, 6px 12px); border-radius: var(--tab-radius, var(--radius-sm)); color: var(--text-muted); font-weight: 550; white-space: nowrap; flex: none; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab.active { background: var(--tab-active-bg, var(--brand-soft)); color: var(--tab-active-text, var(--brand)); }
/* the tab row and the list it belongs to are one card: the row is its head */
.list-card { background: var(--card-bg, var(--panel)); border: 1px solid var(--card-line, var(--line)); border-radius: var(--card-radius, var(--radius)); overflow: hidden; }
.list-card > .list-head { margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.list-card > .topic-rows, .list-card > .post-rows, .list-card > .category-list { border: 0; border-radius: 0; background: none; }
.list-card > .empty { margin: 0; border: 0; }
.list-new { display: flex; justify-content: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.list-new[hidden] { display: none; }
.list-new-btn { border: 0; cursor: pointer; font: inherit; font-size: var(--font-size-sm); color: var(--info); background: var(--info-soft); padding: 7px 18px; border-radius: var(--radius-pill); }
.list-new-btn:hover { filter: brightness(.96); }
.tabs-sub { border: 0; background: none; padding: 0; margin-bottom: 12px; }
.cat-bar { display: flex; gap: 4px; margin-bottom: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.cat-bar::-webkit-scrollbar { display: none; }
.cat-item { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: var(--font-size-sm); font-weight: 550; white-space: nowrap; flex: none; }
.cat-item .icon { width: 15px; height: 15px; opacity: .75; }
.cat-badge .icon, .cat-link .icon { width: 14px; height: 14px; }
.icon-img { object-fit: contain; border-radius: 3px; vertical-align: -2px; }
.chip-item[draggable] { cursor: grab; }
table.sortable tr[draggable] { cursor: grab; }
.admin-advanced { margin-top: 24px; }
.admin-advanced > summary { cursor: pointer; color: var(--text-muted); font-weight: 600; padding: 6px 0; }
.admin-advanced[open] > summary { margin-bottom: 8px; }
table.sortable tr.dragging { opacity: .4; }
.drag-grip { display: inline-flex; color: var(--text-subtle); }
.drag-grip .icon { width: 18px; height: 18px; }
table.sortable tr:hover .drag-grip { color: var(--text-muted); }
.chip-item.dragging { opacity: .4; }
.chip-item .grip { color: var(--text-subtle); letter-spacing: -3px; margin-inline-end: 2px; user-select: none; }
.cat-item:hover { color: var(--text); }
.cat-item.active { color: var(--brand); border-bottom-color: var(--brand); }
.cat-item.active .icon { opacity: 1; }
.cat-bar-mobile { display: none; }
.tabs-sub .tab { padding: 4px 10px; font-size: var(--font-size-sm); }
.icon-picker { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
/* the icon field: the current icon as a button, a panel with search, the tiles, an emoji box and an upload */
.icon-field { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.icon-field > summary { display: flex; align-items: center; gap: 10px; padding: 7px 10px; cursor: pointer; list-style: none; }
.icon-field > summary::-webkit-details-marker { display: none; }
.icon-field-now { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--panel-2); }
.icon-field-now .icon, .icon-field-now img { width: 18px; height: 18px; }
.icon-field-empty { padding: 0 8px; color: var(--text-muted); font-size: var(--font-size-xs); white-space: nowrap; }
.icon-field-label { margin-inline-start: auto; color: var(--brand); font-size: var(--font-size-sm); }
.icon-field[open] > summary { border-bottom: 1px solid var(--line-soft); }
.icon-field-panel { padding: 10px; }
.icon-field-search { width: 100%; margin-bottom: 8px; }
.icon-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; max-height: 240px; overflow-y: auto; }
.icon-field-grid .icon-pick { width: 100%; }
.icon-field-grid .icon-pick[hidden] { display: none; } /* the search hides tiles: [hidden] must win over the tile's inline-flex */
.icon-field-grid .icon-pick-text { grid-column: span 2; width: 100%; padding: 0 6px; font-size: var(--font-size-xs); }
.icon-field-grid .icon-pick-mine { background: var(--panel-2); }
.icon-field-extra { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--text-muted); font-size: var(--font-size-xs); }
.icon-field-extra label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.icon-field-emoji { width: 80px; }
.icon-emoji { display: inline-flex; align-items: center; justify-content: center; font-size: 1em; line-height: 1; font-style: normal; }
.icon-pick { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text-muted); cursor: pointer; }
.icon-pick:hover { color: var(--text); border-color: var(--text-muted); }
.icon-pick.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.icon-pick .icon, .icon-pick img { width: 16px; height: 16px; }
.icon-pick-none { width: auto; padding: 0 8px; font-size: var(--font-size-xs); }

.tab .badge { background: var(--line); color: var(--text-muted); }

/* ---------- topic rows ---------- */
.topic-rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.topic-row { display: flex; align-items: flex-start; gap: 12px; padding: var(--row-pad, 11px 16px); border-bottom: 1px solid var(--row-line, var(--line-soft)); }
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--hover); }
.row-avatar { padding-top: 1px; }
.row-main { flex: 1; min-width: 0; }
.row-title { margin: 0 0 3px; font-size: var(--font-size-lg); font-weight: 500; line-height: 1.35; }
.row-title a { color: var(--text); }
.row-title a:hover { color: var(--brand); }
.row-new { margin-inline-start: 6px; color: var(--brand); font-size: var(--font-size-xs); font-weight: 700; letter-spacing: .02em; vertical-align: 2px; }
.topic-row.read .row-title a { color: var(--text-muted); font-weight: 450; }
.topic-row.read .row-title a:hover { color: var(--brand); }
.topic-row.unread .row-title a { font-weight: 650; }
.row-icon { color: var(--text-subtle); display: inline-flex; vertical-align: -2px; margin-inline-end: 2px; }
.row-icon .icon { width: 14px; height: 14px; }
.row-icon-pin { background: #de6a1e; color: #fff; border-radius: 6px; padding: 3px; vertical-align: -4px; box-shadow: 0 1px 2px rgba(222, 106, 30, .3); }
.row-meta .meta.meta-cat { display: none; }
.row-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--font-size-sm); color: var(--text-subtle); line-height: 1.4; }
.row-meta .meta { display: inline-flex; align-items: center; gap: 3px; color: var(--text-subtle); }
.row-meta .meta .icon { width: 13px; height: 13px; opacity: .8; }
.row-meta .user-link.plain { font-weight: 400; color: var(--text-muted); }
.row-meta .user-link.plain:hover, .row-meta a.meta:hover { color: var(--brand); }
.row-tag::before { content: ""; }
.row-cat { flex: none; align-self: center; padding: 1px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-muted); font-size: var(--font-size-xs); white-space: nowrap; }
.row-cat:hover { border-color: var(--text-subtle); color: var(--text); }
.cat-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-weight: 550; font-size: var(--font-size-sm); }
.cat-badge:hover { color: var(--text); }
.tag-badge { display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--panel-2); border: 1px solid var(--line); color: var(--text-muted); font-size: var(--font-size-xs); font-weight: 500; }
.tag-badge:hover { border-color: var(--brand); color: var(--brand); }
.stat { display: inline-flex; align-items: center; gap: 4px; }
/* Ban or delete a member (app/moderation.php) and the batch bar of Admin → Users */
.mod-page { max-width: 760px; }
.mod-who { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.mod-who h2 { margin: 0 0 4px; font-size: var(--font-size-xl); }
.mod-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.mod-stats div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 12px; }
.mod-stats b { display: block; font-size: var(--font-size-xl); }
.mod-stats span { color: var(--text-muted); font-size: var(--font-size-sm); }
.mod-page h3 { margin: 16px 0 8px; font-size: var(--font-size-md); }
.mod-recent { margin: 0; padding-inline-start: 18px; font-size: var(--font-size-sm); }
.mod-recent li { margin: 3px 0; }
.mod-others { display: grid; gap: 6px; margin-bottom: 12px; }
.mod-other { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-sm); }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.users-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.admin-user-tabs { margin: 8px 0 4px; }

/* Admin → Import (app/admin_import.php): importer rows and the job's progress bars */
.import-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin: 16px 0; max-width: 760px; }
.import-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.import-row:first-child { border-top: 0; }
.import-row-main { flex: 1; min-width: 0; }
.import-icon { width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-muted); }
.import-pill { font-size: var(--font-size-xs); padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--text-muted); }
.import-pill.is-on { background: var(--success-soft); color: var(--success); }
.import-current { margin: 16px 0; }
.import-current h3 { margin: 0 0 12px; }
.import-job { display: grid; gap: 10px; }
.import-phase-head { display: flex; justify-content: space-between; gap: 12px; font-size: var(--font-size-sm); }
.import-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 4px; }
.import-bar i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.import-done { display: flex; align-items: center; gap: 6px; color: var(--success); margin: 6px 0 0; }
.import-notes summary { cursor: pointer; font-size: var(--font-size-sm); }
.import-notes ul { margin: 6px 0 0; padding-inline-start: 20px; font-size: var(--font-size-sm); color: var(--text-muted); }
.import-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.import-stats div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 12px; }
.import-stats b { display: block; font-size: var(--font-size-xl); font-weight: 600; }
.import-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.import-steps span { display: inline-flex; align-items: center; gap: 4px; font-size: var(--font-size-sm); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); }
.import-steps span.is-on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.import-steps span.is-done { color: var(--success); }
@media (max-width: 640px) { .import-row { flex-wrap: wrap; } .import-row .btn { margin-inline-start: 48px; } }

/* Settings → General → Logo (admin_logo_block): style cards, uploads, and a header preview that follows the choices */
.logo-settings { margin: 6px 0 18px; padding: 14px 16px 4px; border: 1px solid var(--line); border-radius: var(--radius); }
.logo-settings legend { padding: 0 6px; font-weight: 600; }
.logo-settings-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.logo-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.logo-choice { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: var(--font-size-sm); cursor: pointer; }
.logo-choice input { position: absolute; opacity: 0; pointer-events: none; }
.logo-choice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.logo-choice:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.logo-choice small { color: var(--text-muted); font-size: var(--font-size-xs); }
.logo-demo { display: flex; align-items: center; gap: 6px; height: 34px; margin-bottom: 6px; padding: 0 8px; overflow: hidden; border-radius: 6px; background: var(--panel-2); font-weight: 600; white-space: nowrap; }
.logo-demo-word { display: block; width: 74px; height: 14px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--brand) 0 10px, color-mix(in srgb, var(--brand) 45%, var(--panel)) 10px 14px); }
.logo-upload { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.logo-upload small { color: var(--text-muted); font-size: var(--font-size-xs); }
.logo-thumb { display: flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; overflow: hidden; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-muted); }
.logo-thumb.wide { width: 120px; }
.logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-upload-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.logo-upload-main small { color: var(--text-muted); font-size: var(--font-size-xs); }
.logo-preview { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 4px; }
.logo-preview small { margin-top: 6px; color: var(--text-muted); font-size: var(--font-size-xs); }
.logo-pv { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: var(--font-size-lg); font-weight: 700; }
.logo-pv.is-phone { max-width: 240px; }
.logo-pv > .icon { width: 18px; height: 18px; color: var(--text-muted); }
.logo-pv .pv-icon { display: flex; }
.logo-pv .pv-icon img { width: 26px; height: 26px; object-fit: contain; }
.logo-pv .pv-logo, .logo-pv .pv-logo-dark { display: none; width: auto; max-width: 160px; height: 28px; object-fit: contain; }
.logo-pv .pv-nav { display: flex; gap: 10px; margin-inline-start: auto; color: var(--text-muted); }
.logo-pv .pv-nav .icon { width: 17px; height: 17px; }
[data-style="image"] .logo-pv .pv-icon, [data-style="image"] .logo-pv .pv-name, [data-style="name"] .logo-pv .pv-icon { display: none; }
[data-style="image"] .logo-pv .pv-logo { display: block; }
[data-style="image"][data-dark="1"] .logo-pv[data-theme="dark"] .pv-logo { display: none; }
[data-style="image"][data-dark="1"] .logo-pv[data-theme="dark"] .pv-logo-dark { display: block; }
[data-style="icon"]:not([data-phone-name="1"]) .logo-pv.is-phone .pv-name { display: none; }
[data-style="image"][data-icon="1"] .logo-pv.is-phone .pv-logo { display: none; }
[data-style="image"][data-icon="1"] .logo-pv.is-phone .pv-icon { display: flex; }
@media (max-width: 900px) { .logo-settings-grid { grid-template-columns: minmax(0, 1fr); } .logo-preview { position: static; } }
@media (max-width: 480px) { .logo-choices { grid-template-columns: minmax(0, 1fr); } }
/* link preview cards (core/links.php): a link on a line of its own in a post, and in lists that show one */
.link-card, .post-content a.link-card { display: flex; flex-direction: column; max-width: 520px; margin: 10px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-decoration: none; transition: border-color .12s; }
.link-card:hover, .post-content a.link-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--text); text-decoration: none; }
.link-card-small, .post-content a.link-card-small { flex-direction: row; }
.link-card-img { position: relative; display: block; overflow: hidden; background: var(--panel-2); }
.link-card-img img, .post-content .link-card-img img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; object-fit: cover; }
.link-card-large .link-card-img { aspect-ratio: 1.91 / 1; }
.link-card-small .link-card-img { flex: none; width: 120px; min-height: 96px; }
.link-card-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 14px; }
.link-card-site { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: var(--font-size-xs); }
.link-card-site .icon { width: 12px; height: 12px; }
.link-card-title { display: -webkit-box; overflow: hidden; font-weight: 600; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-card-desc { display: -webkit-box; overflow: hidden; color: var(--text-muted); font-size: var(--font-size-sm); line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 480px) { .link-card-small .link-card-img { width: 96px; } }
.list-more { display: flex; justify-content: center; margin: 16px 0 0; }
.list-more.is-end { color: var(--text-subtle); font-size: var(--font-size-sm); padding: 8px 0; }
.list-more + .pagination { margin-top: 12px; }
.pagination { display: flex; gap: 4px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .page-cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page-gap { border: 0; background: none; }
.category-head { margin: 0 0 14px; }
.category-head h1 { margin-bottom: 2px; }
.category-head p { margin: 0; }
.cat-children { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.category-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.category-row { display: grid; grid-template-columns: 1fr 140px 220px; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line-soft); align-items: center; }
.category-row:last-child { border: 0; }
.cat-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cat-text { min-width: 0; }
.cat-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-muted); overflow: hidden; }
.cat-icon .icon { width: 24px; height: 24px; }
.cat-icon .icon-img { width: 100%; height: 100%; object-fit: cover; }
.category-row h3 { margin-bottom: 4px; }
.category-row h3 a { color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.category-row p { margin: 0; font-size: var(--font-size-sm); }
.cat-stats { display: flex; flex-direction: column; font-size: var(--font-size-sm); color: var(--text-muted); }
.cat-last { font-size: var(--font-size-sm); min-width: 0; }
.cat-last a { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-last small { color: var(--text-subtle); }
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tag-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tag-card small { color: var(--text-subtle); }

/* ---------- topic page ---------- */
.topic-head { margin-bottom: 14px; }
.topic-title { font-size: var(--font-size-3xl); margin-bottom: 8px; } /* a block, not flex: the pin and lock flow in front of the words, so a long title wraps under them instead of dropping below the icons */
.topic-title .row-icon { margin-inline-end: 6px; vertical-align: -.12em; }
.topic-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: var(--font-size-sm); margin-bottom: 10px; }
.topic-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topic-tools .inline { display: inline; }
/* the title on a line of its own (a long one wraps), then one bar: the topic's numbers on the left, its buttons as icons on the right.
   On page 1 both sit at the top of the opening post; later pages show them above the replies. */
.topic-head .topic-title { margin-bottom: 6px; }
.topic-bar { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.topic-bar .topic-meta { margin: 0; min-width: 0; }
.topic-bar .stat { display: inline-flex; align-items: center; gap: 4px; }
.topic-bar .topic-meta .icon { width: 14px; height: 14px; }
.topic-bar .topic-tools { margin-inline-start: auto; gap: 2px; flex-wrap: nowrap; }
.topic-bar .topic-tools .btn { width: 32px; height: 30px; padding: 0; justify-content: center; border: 0; border-radius: var(--radius-sm); background: none; box-shadow: none; color: var(--text-muted); font-size: var(--font-size-sm); }
.topic-bar .topic-tools .btn:hover { background: var(--panel-2); color: var(--text); }
.topic-bar .topic-tools .btn.active { background: var(--brand-soft); color: var(--brand); }
.topic-bar .topic-tools .btn > span { display: none; } /* icons only: each button carries its name as a tooltip */
.topic-bar .topic-tools .btn .icon { width: 18px; height: 18px; }
.post.first .topic-head { margin: 0 0 12px; }
.post-meta { flex-wrap: wrap; row-gap: 3px; }
.dropdown-form { padding: 4px 6px; }
.post-stream { display: flex; flex-direction: column; gap: 12px; }
.post { display: block; padding: var(--post-pad, 16px); background: var(--card-bg, var(--panel)); border: 1px solid var(--card-line, var(--line)); border-radius: var(--card-radius, var(--radius)); box-shadow: var(--card-shadow, var(--shadow)); scroll-margin-top: calc(var(--topbar-h) + 12px); }

.post.deleted { opacity: .7; border-style: dashed; }
.post.post-pending { border: 1px dashed var(--warning); }

/* review queue (/review, app/views/review.php) */
.review-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 14px 16px 6px; }
.review-head h1 { margin: 0; font-size: var(--font-size-xl); }
.review-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line-soft); transition: opacity .3s; }
.review-item.is-done { opacity: 0; }
.review-main { flex: 1; min-width: 0; }
.review-who .user-link { font-weight: 600; }
.review-where { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.review-chip { padding: 1px 7px; border-radius: 6px; background: var(--panel-2); color: var(--text-muted); font-size: var(--font-size-xs); }
.review-reason { padding: 1px 7px; border-radius: 6px; background: var(--warning-soft); color: var(--warning); font-size: var(--font-size-xs); }
.review-title { display: block; color: var(--text); font-weight: 600; }
.review-text { margin-top: 2px; color: var(--text-muted); font-size: var(--font-size-sm); overflow-wrap: anywhere; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.review-actions .review-danger { color: var(--danger); }
.review-note { display: inline-flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.review-note[hidden] { display: none; }
.review-note input { flex: 1; min-width: 180px; max-width: 420px; }
.review-decided { margin-top: 6px; }
.review-time { white-space: nowrap; }
@media (max-width: 640px) { .review-item { padding: 12px; } .review-time { display: none; } }
.post.highlight { animation: highlight 2.5s ease-out; }
.post[id^="post-"], .posts-new-line { scroll-margin-top: calc(var(--topbar-h) + 12px); } /* a linked post is not hidden under the sticky top bar */
.posts-new-line { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; color: var(--brand); font-size: var(--font-size-xs); font-weight: 600; }
.posts-new-line::before, .posts-new-line::after { content: ""; flex: 1; height: 1px; background: var(--brand); opacity: .45; }
@keyframes highlight { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: var(--shadow); } }
/* post header: avatar on the left, name above the meta line; the body below runs the full width */
.post-body { min-width: 0; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.flag.flag-op { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 50%, var(--text)); font-weight: 600; } /* two classes: a theme restyling .flag keeps the label in the brand colour */
.post-avatar { flex: none; }
.post-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.post-name { display: flex; align-items: center; gap: 6px; font-size: var(--font-size-md); line-height: 1.3; min-width: 0; }
.post-name .user-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-meta { display: flex; align-items: center; gap: 8px; font-size: var(--font-size-xs); color: var(--text-subtle); line-height: 1.3; }
.post-time { color: var(--text-subtle); }
.post-floor { margin-inline-start: auto; align-self: flex-start; color: var(--text-subtle); font-family: var(--mono); font-size: var(--font-size-xs); }
.post-edited { color: var(--text-subtle); display: inline-flex; align-items: center; gap: 3px; }
.reply-quote { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--panel-2); border-inline-start: 3px solid var(--line); border-radius: 4px; color: var(--text-muted); font-size: var(--font-size-sm); }
.reply-quote span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-content { font-size: 15.5px; line-height: 1.7; word-wrap: break-word; overflow-wrap: anywhere; }
.post-content > :first-child { margin-top: 0; } .post-content > :last-child { margin-bottom: 0; }
.post-content h2, .post-content h3, .post-content h4 { margin: 1.2em 0 .5em; text-transform: none; letter-spacing: 0; color: inherit; }
.post-content h2 { font-size: var(--font-size-xl); } .post-content h3 { font-size: var(--font-size-lg); } .post-content h4 { font-size: var(--font-size-md); }
.post-content blockquote { margin: 0 0 1em; padding: 6px 14px; border-inline-start: 3px solid var(--brand); background: var(--panel-2); color: var(--text-muted); border-radius: 0; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.post-content blockquote > :last-child { margin-bottom: 0; }
.post-content img { border-radius: var(--radius-sm); max-height: 600px; max-width: min(100%, var(--post-img-max, 100%)); height: auto; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 2px; }
.post-content ul, .post-content ol { padding-inline-start: 1.6em; margin: 0 0 1em; }
.post-content .table-wrap { overflow-x: auto; max-width: 100%; margin-bottom: 1em; -webkit-overflow-scrolling: touch; contain: inline-size; } /* contain: the wide table must not widen the column */
.post-content table { border-collapse: collapse; width: max-content; min-width: 100%; max-width: none; font-size: var(--font-size-sm); }
.post-content th, .post-content td { border: 1px solid var(--line); padding: 6px 10px; text-align: start; }
.post-content th { background: var(--panel-2); }
.post-content .mention { font-weight: 600; background: var(--brand-soft); padding: 0 4px; border-radius: 4px; }
.post-actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.post-actions .inline { display: inline; }
.act { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-subtle); font: inherit; font-size: var(--font-size-sm); cursor: pointer; }
.act:hover { background: var(--panel-2); color: var(--text); }
.act.active { color: var(--brand); }
.act.active .icon { fill: var(--brand); }
.act.danger:hover { color: var(--danger); }
.act-static { cursor: default; opacity: .6; }
.act-static:hover { background: none; color: var(--text-subtle); }
.composer { margin-top: 24px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.composer h2 { font-size: var(--font-size-lg); }
.composer-locked { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 14px 16px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--text-muted); }
.composer-locked span { flex: 1; }
.reply-target { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--brand-soft); color: var(--brand); border-radius: var(--radius-sm); font-size: var(--font-size-sm); }
.compose h1 { margin-bottom: 14px; }

/* ---------- editor ---------- */
.editor { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); position: relative; }
.editor:focus-within { border-color: var(--brand); }
.editor.dragover { outline: 2px dashed var(--brand); }
/* the mode tabs above the toolbar (composer.modes): Write / Visual / Preview, fullscreen at the end */
.editor-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 6px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.editor-tab { display: inline-flex; align-items: center; gap: 5px; margin-bottom: -1px; padding: 8px 12px 7px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: inherit; font-size: var(--font-size-sm); cursor: pointer; white-space: nowrap; }
.editor-tab .icon { width: 15px; height: 15px; }
.editor-tab:hover { color: var(--text); }
.editor-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--brand); }
.editor-tabs .editor-fs-btn { align-self: center; }
/* the toolbar wraps onto a second row when the composer is narrow, so no button is ever cut off */
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; row-gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-soft); }
.editor-toolbar::-webkit-scrollbar { display: none; }
.tb-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border: 0; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer; font: inherit; font-size: var(--font-size-sm); flex: none; }
.tb-btn:hover, .tb-btn.active { background: var(--panel-2); color: var(--text); }
.tb-btn.active { color: var(--brand); }
.tb-btn .icon { width: 17px; height: 17px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; flex: none; }
.tb-spacer { flex: 1; }
.editor-body { display: grid; grid-template-columns: 1fr; }
.editor.preview-only .editor-body > :not([data-preview]), .editor.preview-only .editor-toolbar, .editor.preview-only .editor-emoji { display: none; } /* the rendered text alone, whatever editor was on */
.editor-input { border: 0; border-radius: 0; min-height: 200px; font-family: var(--mono); font-size: 13.5px; line-height: 1.55; resize: vertical; }
.editor-input:focus { outline: 0; }
.editor-preview { padding: 12px 14px; min-height: 200px; overflow: auto; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-top: 1px solid var(--line-soft); color: var(--text-subtle); font-size: var(--font-size-xs); }
.editor-foot .link { font-size: inherit; }
.editor-draft { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--warning-soft); color: var(--warning); font-size: var(--font-size-sm); border-bottom: 1px solid var(--line-soft); }
.editor-draft span { flex: 1; }
.editor-emoji { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; padding: 8px; border-bottom: 1px solid var(--line-soft); max-height: 160px; overflow: auto; }
.editor-emoji button { border: 0; background: none; font-size: 20px; line-height: 1; padding: 5px 0; border-radius: 4px; cursor: pointer; }
.editor-emoji button:hover { background: var(--panel-2); }
.editor-help { position: absolute; inset-inline-start: 10px; bottom: 34px; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 8px 12px; max-width: 520px; }
.editor-help table { border-collapse: collapse; font-size: var(--font-size-sm); }
.editor-help td { padding: 4px 10px 4px 0; vertical-align: top; color: var(--text-muted); }
.editor-help td:first-child { white-space: nowrap; }
.editor.fullscreen { position: fixed; inset: 0; z-index: 130; border-radius: 0; display: flex; flex-direction: column; }
.editor.fullscreen .editor-body { flex: 1; min-height: 0; }
.editor.fullscreen .editor-input, .editor.fullscreen .editor-preview { height: 100%; min-height: 0; resize: none; }
body.editor-fs { overflow: hidden; }
.mention-menu { position: absolute; inset-inline-start: 12px; bottom: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 20; min-width: 180px; }
.mention-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: start; }
.mention-menu button:hover { background: var(--panel-2); }
.mention-menu button small { margin-inline-start: auto; color: var(--text-muted); font-size: var(--font-size-xs); }
.mention-menu img { width: 20px; height: 20px; border-radius: 50%; }

/* ---------- auth, profile, settings, search, notifications ---------- */
.auth-box { max-width: 400px; margin: 30px auto; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-box h1 { text-align: center; margin-bottom: 20px; }
.req { color: var(--danger); font-weight: 600; margin-inline-start: 2px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 42px; }
.pw-toggle { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); width: 30px; height: 30px; border: 0; background: none; color: var(--text-subtle); cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--text); background: var(--panel-2); }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle .icon:last-child, .pw-toggle.on .icon:first-child { display: none; }
.pw-toggle.on .icon:last-child { display: block; }
.auth-alt { text-align: center; margin: 16px 0 0; color: var(--text-muted); }

/* ---------- legal pages (privacy policy, terms of service) ---------- */
.legal-page { max-width: 840px; margin: 24px auto; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.legal-page h1 { margin-top: 0; }
.legal-page h2 { margin: 26px 0 8px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.legal-page h3 { margin: 18px 0 6px; }
.legal-page p, .legal-page li { line-height: 1.75; }
.legal-page ul { margin: 8px 0; padding-inline-start: 22px; }
.legal-page li { margin: 4px 0; }
.legal-meta { color: var(--text-muted); font-size: var(--font-size-sm); margin-bottom: 4px; }
.agree-row .check { align-items: flex-start; }
.agree-row .check input { margin-top: 3px; }
@media (max-width: 640px) { .legal-page { margin: 12px 0; padding: 18px 16px; border-radius: var(--radius-sm); } }

.field-check { position: relative; display: block; }
.field-check input { padding-inline-end: 38px; }
.field-check.ok input { border-color: var(--success); }
.field-mark { position: absolute; top: 50%; inset-inline-end: 10px; transform: translateY(-50%); display: inline-flex; color: var(--success); pointer-events: none; }
.field-mark svg { width: 18px; height: 18px; }
.category-head .cat-main { align-items: center; gap: 14px; }
.cat-icon-lg { width: 62px; height: 62px; border-radius: 16px; }
.cat-icon-lg svg.icon { width: 46px; height: 46px; }
.category-head .cat-text h1 { margin: 0; }
.category-head .cat-text p { margin: 2px 0 0; font-size: var(--font-size-sm); }
.post-deleted { margin-top: 6px; }
.post-deleted > summary { display: inline-flex; cursor: pointer; font-size: var(--font-size-sm); color: var(--text-subtle); }
.post-deleted > summary:hover { color: var(--text-muted); }
.post-deleted .post-content { margin-top: 8px; opacity: .75; }
/* profile, option A: a head card across the page (avatar | name, labels, bio, details | buttons; the number tiles in a row under
   them), then the lists beside a column of sections (progress, badges, member.sections) */
.profile { display: flex; flex-direction: column; gap: var(--gap); }
.profile-card { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; background: var(--card-bg, var(--panel)); border: 1px solid var(--card-line, var(--line)); border-radius: var(--card-radius, var(--radius)); box-shadow: var(--card-shadow, var(--shadow)); }
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 6px 20px; }
.profile-head .avatar { width: 96px; height: 96px; font-size: 38px; }
.profile-head .online-dot { width: 18px; height: 18px; top: 4px; left: 4px; border-width: 3px; } /* sized for the big avatar, not in proportion to it */
.profile-id { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 4px; }
.profile-name { margin: 0; font-size: var(--font-size-2xl); line-height: 1.25; overflow-wrap: anywhere; }
.profile-handle { margin-top: 1px; color: var(--text-muted); font-size: var(--font-size-sm); }
.profile-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: -2px; }
.profile-labels:empty { display: none; }
.profile-bio { margin: 0; max-width: 640px; color: var(--text); overflow-wrap: anywhere; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-muted); font-size: var(--font-size-sm); }
.profile-meta > span { display: inline-flex; align-items: center; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-meta > [data-slot]:empty { display: none; }
.profile-meta .icon { width: 15px; height: 15px; flex: none; margin-inline-end: 6px; }
.profile-side { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding-top: 4px; }
.profile-side:empty { display: none; }
.profile-side > .btn-primary { order: -1; } /* the main action on someone else's profile (Message) comes first */
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pstat { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); }
.pstat b { font-size: var(--font-size-lg); line-height: 1.2; }
.pstat span, .pstat small { overflow: hidden; color: var(--text-muted); font-size: var(--font-size-xs); white-space: nowrap; text-overflow: ellipsis; }
a.pstat:hover { background: var(--brand-soft); text-decoration: none; }
a.pstat:hover b { color: var(--brand); }
/* a number with progress (the level) runs across its card with its bar */
.pstat-wide { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; column-gap: 8px; }
.pstat-bar { grid-column: 1 / -1; display: block; height: 6px; margin-top: 7px; border-radius: 3px; background: linear-gradient(var(--brand), var(--brand)) 0 0 / var(--p, 0%) 100% no-repeat, var(--line); }
.profile-progress .card-body { display: flex; flex-direction: column; gap: 8px; }
.profile-progress .pstat { padding: 0; background: none; }
.profile-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: var(--gap); }
.profile-body-full { grid-template-columns: minmax(0, 1fr); }
.profile-main { min-width: 0; }
.profile-aside { min-width: 0; position: sticky; top: calc(var(--topbar-h) + 20px); } /* the sections stay in view beside a long list */
.profile-section .card-head a { font-size: var(--font-size-sm); }
.profile-section .badge-profile { margin: 0; }
.profile-section .badge-profile-label { display: none; }
/* the list tabs: one segmented control at the start of the list head */
.page-profile .list-card > .list-head { justify-content: flex-start; }
.page-profile .list-head .tabs { gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--panel-2); }
.page-profile .list-head .tab.active { background: var(--card-bg, var(--panel)); }
.post-rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.post-row { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.post-row:last-child { border: 0; }
.post-excerpt { color: var(--text-muted); font-size: var(--font-size-sm); margin: 4px 0 6px; }
.post-hold { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--warning); border-radius: var(--radius); background: var(--warning-soft); }
.post-hold > .icon { width: 20px; height: 20px; flex: none; color: var(--warning); margin-top: 1px; }
.post-hold b { display: block; font-weight: 600; }
.composer-extra { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.composer-extra > summary { display: flex; align-items: center; gap: 6px; padding: 9px 12px; cursor: pointer; color: var(--text-muted); font-size: var(--font-size-sm); }
.composer-extra > summary .icon { width: 16px; height: 16px; }
.composer-extra[open] > summary { border-bottom: 1px solid var(--line-soft); }
.composer-extra > .form-row, .composer-extra > div { padding: 0 12px; }
.composer-extra > div:last-child, .composer-extra > .form-row:last-child { padding-bottom: 12px; }
.reply-denied { margin-top: 16px; }
.settings { max-width: 880px; margin: 0 auto; }
.settings-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-menu { position: sticky; top: calc(var(--topbar-h) + 20px); }
.settings-menu h4 { margin: 16px 0 4px; padding: 0 10px; }
.settings-menu h4:first-child { margin-top: 4px; }
.settings-menu .side-link { padding: 6px 10px; }
.settings-chev, .settings-back, .settings-current { display: none; }
@media (max-width: 768px) {
  /* phones: /settings is a list of sections (grouped rows with a chevron); a section page shows a back link and the form */
  .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .settings-menu { display: none; position: static; }
  .settings-index .settings-menu { display: block; }
  .settings-index .settings-body, .settings-index h1 + .settings-grid .settings-body { display: none; }
  .settings-index .settings-menu h4 { margin: 18px 0 6px; padding: 0 4px; }
  .settings-index .settings-menu h4:first-child { margin-top: 0; }
  .settings-index .settings-menu .side-link { display: flex; align-items: center; margin: 0; padding: 13px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0; background: var(--panel); color: var(--text); font-size: var(--font-size-md); }
  .settings-index .settings-menu .side-link.active { background: var(--panel); color: var(--text); }
  .settings-index .settings-menu h4 + .side-link { border-top: 1px solid var(--line); border-start-start-radius: var(--radius); border-start-end-radius: var(--radius); }
  .settings-index .settings-menu .side-link:last-child, .settings-index .settings-menu .side-link:has(+ h4) { border-end-start-radius: var(--radius); border-end-end-radius: var(--radius); }
  .settings-index .settings-chev { display: block; margin-inline-start: auto; width: 16px; height: 16px; color: var(--text-subtle); }
  .settings:not(.settings-index) h1 { display: none; }
  .settings-back { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 6px; color: var(--text-muted); font-size: var(--font-size-sm); }
  .settings-back .icon { width: 16px; height: 16px; }
  .settings-current { display: block; margin: 0 0 12px; }
  .settings-form { max-width: none; }
}
.settings-form { max-width: 560px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.search-results { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.search-result { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.search-result:last-child { border: 0; }
.snippet { color: var(--text-muted); font-size: var(--font-size-sm); margin: 4px 0 6px; }
.search-section { margin-bottom: 20px; }
.search-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.search-section-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--font-size-lg); font-weight: 700; }
.search-section-title .icon { color: var(--text-muted); }
.search-section-more { display: inline-flex; align-items: center; gap: 2px; font-size: var(--font-size-sm); font-weight: 600; color: var(--brand); }
.notif-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.notif:last-child { border: 0; }
.notif:hover { background: var(--hover); }
.notif.unread { background: color-mix(in srgb, var(--brand-soft) 50%, var(--panel)); }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); display: inline-flex; align-items: center; justify-content: center; color: var(--brand); flex: none; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { display: block; }
.notif-excerpt { display: block; color: var(--text-muted); font-size: var(--font-size-sm); }
.notif-time { color: var(--text-subtle); font-size: var(--font-size-sm); white-space: nowrap; }
.error-box { text-align: center; padding: 60px 20px; }
.error-box h1 { font-size: 56px; color: var(--text-disabled); }

/* ---------- points (core ledger UI) ---------- */
.points-balance { margin: 0 0 12px; }
.points-balance b { font-size: var(--font-size-2xl); color: var(--brand); margin-inline-end: 4px; }
/* /points: balance card, ways to earn as tiles, history by day */
.points-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; padding: 20px 22px; background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 20%, var(--line)); }
.points-hero small { display: block; color: color-mix(in srgb, var(--brand) 55%, var(--text)); font-size: var(--font-size-sm); }
.points-hero-balance { display: flex; align-items: baseline; gap: 6px; color: var(--brand); font-size: 40px; line-height: 1.1; }
.points-hero-balance span { font-size: var(--font-size-md); font-weight: 500; }
.points-hero-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.points-chip { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 150px; padding: 5px 10px; border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: var(--font-size-sm); }
.points-hero .points-chip small { color: var(--text-muted); font-size: var(--font-size-xs); }
.points-chip-bar { flex-basis: 100%; height: 4px; margin-top: 3px; border-radius: 2px; background: linear-gradient(var(--brand), var(--brand)) 0 0 / var(--p, 0%) 100% no-repeat, var(--line); }
.points-hero-month { display: flex; flex-direction: column; gap: 4px; }
.points-hero-month > div { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
.points-hero-month b { font-size: var(--font-size-xl); }
.points-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 14px 16px 16px; }
.points-tile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.points-tile:hover { border-color: var(--brand); background: var(--brand-soft); }
.points-tile-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.points-tile-icon .icon { width: 18px; height: 18px; }
.points-tile-text { min-width: 0; }
.points-tile-text b, .points-tile-text small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.points-tile-text small { color: var(--text-muted); font-size: var(--font-size-xs); }
.points-tile.is-primary { border-color: var(--brand); }
.points-tile.is-primary small { color: var(--brand); font-weight: 600; }
.points-tile.is-done .points-tile-icon { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.page-points .card { margin-bottom: 14px; }
.page-points .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.page-points .card-head .tabs { margin: 0; }
.points-amount { width: 90px; }
b.up { color: var(--success); } b.down { color: var(--danger); }
.points-log { list-style: none; margin: 0; padding: 0; }
.points-log li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--font-size-sm); }
.points-log li:last-child { border: 0; }
.points-log li.points-day { padding: 12px 0 4px; border: 0; color: var(--text-subtle); font-size: var(--font-size-xs); font-weight: 600; }
.points-log li.points-day:first-child { padding-top: 0; }
.points-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; }
.points-icon .icon { width: 15px; height: 15px; }
.points-icon.up { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.points-icon.down { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.points-what { flex: 1; min-width: 0; }
.points-what a { color: var(--text); }
.points-what a:hover { color: var(--brand); }
.points-what small { display: block; overflow: hidden; color: var(--text-subtle); font-size: var(--font-size-xs); white-space: nowrap; text-overflow: ellipsis; }
.points-log b { flex: none; min-width: 40px; text-align: end; font-variant-numeric: tabular-nums; }
.settings-points { max-width: 640px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--footer-line, var(--line)); background: var(--footer-bg, var(--panel)); margin-top: auto; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; font-size: var(--font-size-sm); color: var(--text-muted); flex-wrap: wrap; }
.footer-inner .region { display: flex; gap: 12px; }
.footer-links { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); white-space: nowrap; }
.footer-links a:hover { color: var(--brand); }

/* ---------- setup ---------- */
.page-setup { display: block; padding: 30px 16px; }
.setup { max-width: 720px; margin: 0 auto; }
.setup .card { margin-bottom: 16px; }
.setup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.setup-head h1 { margin: 0; } .setup-head small { color: var(--text-subtle); font-weight: 400; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.check-list li::before { content: "✓"; color: var(--success); margin-inline-end: 8px; font-weight: 700; }
.check-list li.bad::before { content: "✗"; color: var(--danger); }
.check-list li.warn::before { content: "!"; color: var(--warning); }
.check-list li span { flex: 1; }
.check-list small { color: var(--text-subtle); }

/* ---------- admin ---------- */
.admin-page h1 { display: flex; align-items: center; gap: 10px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.admin-cards .card-body b { display: block; font-size: var(--font-size-3xl); }
.admin-cards .card-body span { color: var(--text-muted); font-size: var(--font-size-sm); }
.admin-form { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 760px; }
.admin-form fieldset { border: 0; padding: 0; margin: 0 0 20px; }
.admin-form legend { font-weight: 650; font-size: var(--font-size-lg); margin-bottom: 10px; padding: 0; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.admin { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
table.admin th, table.admin td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: start; vertical-align: middle; }
table.admin th { background: var(--panel-2); font-weight: 600; color: var(--text-muted); }
table.admin tr:last-child td { border: 0; }
table.admin td form { display: inline; }
.admin-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-toolbar input[type="search"] { max-width: 320px; }
.image-current { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.image-current img { max-height: 48px; max-width: 200px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; background: var(--panel-2); }
.admin-toolbar form { display: flex; gap: 8px; }
.plugin-item { display: flex; gap: 16px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; align-items: flex-start; }
.plugin-main { flex: 1; min-width: 0; }
.plugin-main h3 { margin-bottom: 2px; }
.plugin-meta { color: var(--text-subtle); font-size: var(--font-size-xs); display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; }
.plugin-ops { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin-sub { font-size: var(--font-size-md); margin: 18px 0 2px; }
.admin-sub:first-child { margin-top: 0; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-sm); }
.chip .order { display: inline-flex; margin-inline-start: -2px; }
.chip .order button { border: 0; background: none; padding: 0 1px; cursor: pointer; color: var(--text-subtle); line-height: 1; }
.chip .order button:hover { color: var(--text); }
.chip .order .icon { width: 14px; height: 14px; }
textarea.mono { font-family: var(--mono); font-size: 12px; }


/* ---------- admin: page head, tables, drawer, switch ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; }
.side-group { padding: 12px 10px 4px; margin: 0; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.row-menu .dropdown-menu { min-width: 170px; }
.dropdown-menu .danger, .dropdown-menu a.danger { color: var(--danger); }
.dropdown-menu .action-form { margin: 0; }
.switch { position: relative; width: 34px; height: 20px; border: 0; border-radius: 10px; background: var(--text-disabled); cursor: pointer; padding: 0; transition: background .15s; vertical-align: middle; }
.switch span { position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--success); }
.switch.on span { inset-inline-start: 16px; }
.form-actions.sticky { position: sticky; bottom: 0; margin: 16px -18px -18px; padding: 12px 18px; background: var(--panel); border-top: 1px solid var(--line); }
.admin-full .form-actions.sticky { margin: 16px -20px -20px; padding: 12px 20px; }
.drawer-links { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 0; }
.drawer-links a { padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: var(--font-size-sm); color: var(--text-muted); }
.drawer-links a.active, .drawer-links a:hover { border-color: var(--brand); color: var(--brand); }
.admin-full .drawer-links { padding: 0 0 12px; }
.adrawer-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 110; }
.adrawer { position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: 480px; max-width: 100vw; background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-md); z-index: 120; display: flex; flex-direction: column; animation: adrawer-in .18s ease-out; }
@keyframes adrawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.adrawer-head { display: flex; align-items: flex-start; gap: 6px; padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.adrawer-head > div { flex: 1; min-width: 0; }
.adrawer-head b { font-size: var(--font-size-lg); }
.adrawer-body { flex: 1; overflow: auto; padding: 18px; }
.adrawer-body .form-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
body.adrawer-open { overflow: hidden; }
@media (max-width: 640px) { .adrawer { width: 100%; border: 0; } .admin-head { flex-direction: column; align-items: flex-start; } }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .page-grid { grid-template-columns: var(--left-w) minmax(0, 1fr); }
  body.no-left .page-grid { grid-template-columns: minmax(0, 1fr); }
  .col-right { grid-column: 2; }
  body.no-left .col-right { grid-column: 1; }
  .card-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .page-topic .card-stack { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 992px) {
  :root { --gap: 16px; --page-x: 16px; }
  /* clip, not hidden: overflow-x: hidden on both html and body turns body into a scroll box and the sticky top bar scrolled away */
  html, body { overflow-x: clip; }
  @supports not (overflow: clip) { html { overflow-x: hidden; } body { overflow-x: visible; } }
  .col-main, .col-right { min-width: 0; max-width: 100%; }
  .topic-title, .post-content, .row-meta, .list-head h1 { overflow-wrap: anywhere; }
  .post-content pre { max-width: 100%; }
  .page-grid, body.no-left .page-grid, body.no-right .page-grid { grid-template-columns: minmax(0, 1fr); padding-top: 14px; }
  .cat-bar-mobile { display: flex; }
  .cat-bar { margin: -14px calc(-1 * var(--page-x)) 12px; padding: 0 calc(var(--page-x) - 8px); max-width: none; background: var(--panel); gap: 0; }
  .cat-item { padding: 10px 9px; }
  .col-right, body.no-left .col-right { grid-column: 1; }
  .drawer-toggle { display: inline-flex; }
  .col-left { position: fixed; top: 0; inset-inline-start: 0; bottom: 0; width: 280px; max-width: 85vw; background: var(--panel); border-inline-end: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; z-index: 100; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  body.drawer-open .col-left { transform: none; visibility: visible; transition: transform .2s; }
  [dir="rtl"] .col-left { transform: translateX(100%); }
  [dir="rtl"] body.drawer-open .col-left { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 90; display: none; }
  body.drawer-open .drawer-backdrop { display: block; }
  .topnav { display: none; }
  .drawer-nav { display: block; }
  .search-form { width: 160px; }
  .category-row { grid-template-columns: 1fr; gap: 6px; }
  .cat-last { display: none; }
  .cat-stats { flex-direction: row; gap: 12px; }
}
@media (max-width: 640px) {
  :root { --page-x: 12px; }
  .search-form { display: none; }
  .search-toggle { display: inline-flex; }
  .admin-toolbar .search-form { display: flex; width: 100%; flex: 1 1 100%; }
  .admin-toolbar form { flex-wrap: wrap; }
  table.admin th, table.admin td { padding: 8px 10px; }
  table.admin .plugin-desc { display: none; }
  table.admin td .row-actions { white-space: nowrap; }
  .logo-text { display: none; }
  .logo .logo-text.keep, .logo-name .logo-text { display: inline; }
  .logo.has-phone .logo-img, .logo.has-phone .logo-img-dark { display: none; }
  .logo.has-phone .logo-phone { display: flex; }
  .topbar-right .btn { padding: 6px 10px; }
  :root { --gap: 12px; }
  .page-grid { padding-top: 12px; }
  .list-head { margin-bottom: 8px; gap: 8px; }
  .list-card > .list-head { padding: 6px 8px; }
  /* New Topic on a phone is the header's +, first of the buttons on the right on a soft brand-coloured circle, on every page:
     nothing floats over the list, so it never meets another plugin's floating button. The list's own button steps aside */
  .list-head .list-new-topic { display: none; }
  .topbar-right > .theme-toggle, .topbar-right > .lang-menu { display: none; } /* in the account menu or the drawer instead */
  .quick-prefs { display: inline-flex; }
  .drawer-quick { display: flex; }
  /* the top bar stays at the top and steps out of the way while reading: it slides up as the page scrolls down and comes back
     as soon as it scrolls up (app.js sets body.topbar-away) */
  .topbar { transition: transform .25s ease; will-change: transform; }
  body.topbar-away .topbar { transform: translateY(-100%); }
  body.topbar-away .topbar:focus-within, body.drawer-open .topbar { transform: none; }
  .header-new-topic { order: -1; width: 32px; height: 32px; margin-inline-end: 2px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
  .header-new-topic:hover, .header-new-topic:active { background: color-mix(in srgb, var(--brand) 18%, var(--panel)); color: var(--brand); }
  .header-new-topic .icon { width: 19px; height: 19px; stroke-width: 2.4; }
  .cat-bar { margin: -12px calc(-1 * var(--page-x)) 10px; padding: 0 calc(var(--page-x) - 8px); }
  .editor-toolbar .tb-spacer { flex: 1 0 0; }
  .tab { padding: 4px 9px; font-size: var(--font-size-sm); }
  .topic-row { gap: 8px; padding: 10px var(--page-x); }
  .row-avatar .avatar { width: 32px; height: 32px; font-size: 14px; }
  .row-title { font-size: 15px; margin-bottom: 5px; }
  .row-meta { gap: 8px; font-size: var(--font-size-xs); }
  .row-cat, .row-meta .row-tag { display: none; }
  .row-meta .meta.meta-cat { display: inline-flex; color: var(--text-muted); }
  /* phones: cards run edge to edge — hairlines replace rounded corners, side borders and drop shadows */
  .card, .list-card, .search-results, .notif-list, .post, .composer { margin-inline: calc(-1 * var(--page-x)); border-radius: 0; border-inline: 0; box-shadow: none; }
  .card-stack { gap: 8px; }
  .card-body { padding: 14px var(--page-x); }
  .card-head { padding: 10px var(--page-x); }
  .list-card > .list-head { padding: 6px var(--page-x); }
  .me-stats > * { padding: 6px 4px; }
  .me-stats b { font-size: var(--font-size-md); }
  .card-stack { gap: 8px; }
  .post-stream { gap: 8px; }
  .composer { padding: 12px var(--page-x); margin-top: 14px; }
  .topic-head { margin-bottom: 10px; }
  .topic-title { font-size: var(--font-size-2xl); }
  .post { padding: 14px var(--page-x); }
  .post-head { margin-bottom: 10px; }
  .post-avatar .avatar { width: 36px; height: 36px; font-size: 15px; }
  .act span, .tb-preview span { display: none; }
  .act[data-like] span { display: inline; }
  .post-actions { gap: 0; }
  .act { padding: 4px 5px; }
  /* one line on a phone: the numbers give way (clipped) before the icons wrap under them */
  .topic-bar { flex-wrap: nowrap; gap: 8px; }
  .topic-bar .topic-meta { gap: 8px; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .topic-bar .topic-tools .btn { width: 28px; }
  /* phones: the links first as a centred wrapped row, the copyright and "powered by" as one centred line below */
  .footer-inner { justify-content: center; text-align: center; gap: 8px 14px; padding-top: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .footer-links { order: -1; flex-basis: 100%; justify-content: center; gap: 6px 18px; margin-bottom: 4px; }
  .footer-inner .region { justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
  .me-stats span { font-size: 10px; }
}

/* right-to-left languages (lang pack __dir => rtl): mirror the icons that point somewhere */
[dir="rtl"] .icon-reply, [dir="rtl"] .icon-arrow-left, [dir="rtl"] .icon-chevron-left, [dir="rtl"] .icon-chevron-right, [dir="rtl"] .icon-logout { transform: scaleX(-1); }

/* ---------- themes: Admin → Appearance → Themes, and the bar an admin sees while previewing a theme ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.theme-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.theme-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.theme-shot { aspect-ratio: 3 / 2; background: var(--panel-2); border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.theme-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.theme-body { display: flex; flex-direction: column; gap: 3px; flex: 1; padding: 12px 14px 14px; }
.theme-body h3 { margin: 0; font-size: var(--font-size-md); }
.theme-desc { flex: 1; margin: 4px 0 6px; color: var(--text-muted); font-size: var(--font-size-sm); }
.theme-warn { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 4px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--warning-soft); font-size: var(--font-size-xs); overflow-wrap: anywhere; }
.theme-warn .icon { flex: none; width: 14px; height: 14px; margin-top: 1px; color: var(--warning); }
.theme-error { background: var(--danger-soft); } .theme-error .icon { color: var(--danger); }
.theme-ops { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.theme-ops form { margin: 0; }
.theme-ops .flag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; }
.theme-ops .flag .icon { width: 13px; height: 13px; }
.theme-ops .row-menu { margin-inline-start: auto; }
.theme-foot { margin-top: 14px; }
.theme-swatch { display: grid; grid-template-columns: 24% 1fr; grid-template-rows: 14% 1fr; width: 100%; height: 100%; background: var(--sw-bg); }
.theme-swatch i, .theme-swatch b, .theme-swatch s { display: block; font-style: normal; text-decoration: none; }
.theme-swatch .sw-top { grid-column: 1 / -1; display: flex; align-items: center; padding: 0 5%; background: var(--sw-panel); border-bottom: 1px solid var(--sw-line); }
.theme-swatch .sw-top b { width: 12%; height: 42%; border-radius: 3px; background: var(--sw-brand); }
.theme-swatch .sw-side { display: flex; flex-direction: column; gap: 7px; padding: 14px 12%; }
.theme-swatch .sw-side s { height: 6px; border-radius: 3px; background: var(--sw-line); }
.theme-swatch .sw-side s:first-child { background: var(--sw-brand); }
.theme-swatch .sw-main { display: flex; flex-direction: column; gap: 8px; padding: 12px 8% 12px 0; }
.theme-swatch .sw-card { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 9px 10px; background: var(--sw-panel); border: 1px solid var(--sw-line); border-radius: min(var(--sw-radius), 10px); }
.theme-swatch .sw-card b { width: 55%; height: 7px; border-radius: 3px; background: var(--sw-text); opacity: .75; }
.theme-swatch .sw-card s { width: 85%; height: 5px; border-radius: 3px; background: var(--sw-line); }
.theme-preview-bar { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; padding: 7px 12px; background: var(--text); color: var(--panel); font-size: var(--font-size-sm); }
.theme-preview-bar .icon { width: 16px; height: 16px; }
.theme-preview-bar form { margin: 0; }

/* ---------- profile: narrower screens and phones ---------- */
@media (max-width: 1100px) {
  .profile-body { grid-template-columns: minmax(0, 1fr); }
  .profile-aside { position: static; order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
}
@media (max-width: 768px) {
  /* the head card: avatar beside name and labels, then bio, details, the buttons side by side, three numbers to a row */
  .profile { gap: 12px; }
  .profile-card { gap: 12px; padding: 14px; }
  .profile-head { grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; }
  .profile-head .avatar { width: 64px; height: 64px; font-size: 26px; }
  .profile-head .online-dot { width: 13px; height: 13px; top: 1px; left: 1px; border-width: 2px; }
  .profile-id { gap: 6px; padding-top: 2px; }
  .profile-name { font-size: var(--font-size-xl); }
  .profile-bio { font-size: var(--font-size-sm); }
  .profile-meta { gap: 2px 12px; font-size: var(--font-size-xs); }
  .profile-meta > span { white-space: pre; }
  .profile-side { grid-column: 1 / -1; flex-wrap: nowrap; justify-content: stretch; padding-top: 0; }
  .profile-side > .btn { flex: 1 1 0; justify-content: center; }
  .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-top: 12px; }
  .pstat { padding: 7px 9px; }
  .pstat b { font-size: var(--font-size-md); }
  .profile-aside { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .page-profile .list-head .tabs { width: 100%; }
  .page-profile .list-head .tab { flex: 1 1 0; justify-content: center; }
}

/* ---------- points page on phones ---------- */
@media (max-width: 640px) {
  .points-hero { align-items: flex-start; padding: 16px; }
  .points-hero-balance { font-size: 34px; }
  .points-hero-month { flex-direction: row; gap: 16px; }
  .points-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
  .points-tile { gap: 8px; padding: 8px; }
  .points-tile-icon { width: 30px; height: 30px; }
}

/* ============================================================================
   The site's shape language. Colours stay exactly as they are; only geometry,
   spacing and motion change here: rounded-square skins, hairline cards that
   deepen on hover instead of moving, a marker on the row under the pointer,
   controls that sink a hair when pressed, and a scrollbar that belongs to the
   page. Nothing jumps, nothing glows.
   ============================================================================ */

/* skins are squares — every avatar, its online marker and its upload preview share one small radius */
.avatar-letter { letter-spacing: 0; }

/* cards rest on the page with a hairline and a whisper of shade; a hover deepens the line, it never shifts the layout */
.card, .list-card, .post, .composer, .search-results, .notif-list {
  box-shadow: var(--depth-1);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.card:hover, .list-card:hover, .post:hover, .composer:hover { border-color: color-mix(in srgb, var(--text) 12%, var(--line)); }
[data-theme="dark"] .card, [data-theme="dark"] .list-card, [data-theme="dark"] .post,
[data-theme="dark"] .composer, [data-theme="dark"] .search-results, [data-theme="dark"] .notif-list { box-shadow: none; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .card, [data-theme="auto"] .list-card, [data-theme="auto"] .post,
  [data-theme="auto"] .composer, [data-theme="auto"] .search-results, [data-theme="auto"] .notif-list { box-shadow: none; }
}

/* a small solid square leads every card title: the one place the page says "block" */
.card-head h3::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 8px; border-radius: 1px; background: var(--brand); vertical-align: 1px; }
.card-head h3 { letter-spacing: -.005em; }

/* the thread row under the pointer marks its left edge, and a read one marks it quietly */
.topic-row { position: relative; transition: background .14s ease; }
.topic-row::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 0; width: 2px; border-radius: 1px; background: var(--brand); opacity: 0; transition: opacity .14s ease; }
.topic-row:hover::before { opacity: 1; }
.topic-row.read:hover::before { background: var(--text-subtle); }

/* the bar's current page keeps a short underline */
.topnav a { position: relative; }
.topnav a.active::after { content: ""; position: absolute; inset-inline: 10px; bottom: 3px; height: 2px; border-radius: 1px; background: var(--brand); }

/* controls answer a press by sinking a hair; hover is colour only, so nothing moves under the pointer */
.btn, .icon-btn, .act, .tab, .cat-item, .fb-select-btn {
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .09s ease;
}
.btn:active, .icon-btn:active, .act:active, .fb-select-btn:active { transform: translateY(1px); }
.btn[disabled]:active, .btn:disabled:active { transform: none; }

/* a quieter focus ring: two soft pixels rather than a glow */
input:focus, select:focus, textarea:focus, .fb-select-btn:focus-visible, .fb-file-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent);
  outline-offset: 0;
  border-color: var(--brand);
}

/* numbers line up column to column */
.me-stats b, .pstat b, .import-stats b, .topic-bar .stat { font-variant-numeric: tabular-nums; }

/* headings a touch tighter, so a page reads as one block */
h1 { letter-spacing: -.015em; }

/* the scrollbar belongs to the page, not to the browser's default */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 28%, transparent); background-clip: content-box; }

/* phones: no shade at all, and the row marker grows a hair so a thumb can see it */
@media (max-width: 640px) {
  .card, .list-card, .post, .composer, .search-results, .notif-list { box-shadow: none; }
  .topic-row::before { width: 3px; inset-block: 6px; }
  .card-head h3::before { width: 6px; height: 6px; }
}

/* ============================================================================
   Page motion. A link never makes the page jump: the new page simply fades up to
   full opacity, and where the browser animates cross-document View Transitions
   the two pages cross-fade as one surface. No movement, no scale, no blur, no
   staggered rows — the eye is never asked to re-focus.
   ============================================================================ */
@view-transition { navigation: auto; }
@keyframes fbLeave { to { opacity: 0; } }
@keyframes fbArrive { from { opacity: 0; } to { opacity: 1; } }
@keyframes fbAppear { from { opacity: 0; } to { opacity: 1; } }
::view-transition-old(root) { animation: fbLeave .14s ease both; }
::view-transition-new(root) { animation: fbArrive .2s ease both; }

@media (prefers-reduced-motion: no-preference) {
  .col-main { animation: fbAppear .2s ease-out both; }
  /* the browser is cross-fading whole pages: the shell holds still, so nothing fades twice */
  html:active-view-transition .col-main { animation: none; }
}
/* ============================================================================
   Design system. No colour is introduced or changed here. This layer fixes the
   type scale, the spacing rhythm, the radius and depth steps, the state of every
   control, and the micro-motion, so all pages answer the pointer the same way.
   ============================================================================ */
:root {
  /* proportions */
  --topbar-h: 60px; --left-w: 232px; --right-w: 296px; --container: 1240px;
  --radius: 8px; --radius-sm: 6px; --line-height: 1.62;
  /* one type scale for the whole site */
  --font-size-sm: 12.5px; --font-size-lg: 16px;
  --font-size-xl: 19px; --font-size-2xl: 24px; --font-size-3xl: 30px;
  /* one spacing rhythm */
  --space-3: 12px; --space-4: 16px;
  /* one depth step for raised cards */
  --depth-1: 0 1px 2px rgba(16, 24, 40, .04);
  /* one motion language */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --dur-1: .12s;
}

/* ---------- type ---------------- */
h1 { font-size: var(--font-size-2xl); font-weight: 700; letter-spacing: -.02em; }
.card-head h3 { font-weight: 650; letter-spacing: -.005em; }
/* a list speaks in exactly three sizes: the title, its meta, the aside */
.row-title { font-size: var(--font-size-lg); font-weight: 550; letter-spacing: -.006em; line-height: 1.4; }
.row-meta { font-size: var(--font-size-sm); gap: 10px; }
.post-content { line-height: 1.72; }
/* numbers line up everywhere */
.me-stats b, .pstat b, .import-stats b, .topic-bar .stat, .pagination span { font-variant-numeric: tabular-nums; }

/* ---------- rhythm: the main column leads, the side columns follow ---------- */
.logo { font-size: var(--font-size-xl); margin-inline-end: 18px; }
.topbar-inner { gap: 10px; }
.page-grid { padding-top: 26px; padding-bottom: 56px; }
.card-stack { gap: var(--space-4); }
.post-stream { gap: var(--space-3); }
.topic-row { padding: var(--row-pad, 13px 18px); }
.card-head { padding: var(--card-head-pad, 14px 18px); }
.card-body { padding: var(--card-pad, 18px); }
.form-row { margin-bottom: var(--space-4); }
.side-nav, .side-section { margin-bottom: 22px; }
.side-link { padding: 9px 11px; gap: 11px; }
.side-group { margin: 18px 11px 6px; }

/* the side column steps back: tighter boxes, no title marks, so the list keeps the eye */
.col-right .card-head { padding: 12px 14px; }
.col-right .card-body { padding: 14px; }
.col-right .card-head h3::before { display: none; }
.col-right .card { box-shadow: none; }

/* ---------- states: every control answers the same way ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 550; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:disabled:active, .btn[aria-disabled="true"]:active { transform: none; }
input, select, textarea, .fb-select-btn, .fb-file-btn {
  transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), outline-color var(--dur-1) var(--ease-out);
}
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
.tab { border-radius: var(--radius-sm); }
.tab.active { font-weight: 650; }
.topic-row { transition: background-color var(--dur-1) var(--ease-out); }
.pagination a, .pagination span { border-radius: var(--radius-sm); transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out); }

/* keyboard users see one ring everywhere */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 34%, transparent);
  outline-offset: 2px;
}

/* ---------- micro-motion: menus and panels arrive, they never appear from nowhere ---------- */
@keyframes fbPop { from { opacity: 0; } to { opacity: 1; } }
@keyframes fbLift { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .dropdown.open .dropdown-menu, .fb-select.open .fb-select-menu { animation: fbPop .16s var(--ease-out) both; }
  .flash { animation: fbLift .28s var(--ease-out) both; }
  .toast.show { transition-timing-function: var(--ease-out); }
}

/* touch screens get targets a thumb can hit, not a cursor */
@media (hover: none) and (pointer: coarse) {
  .icon-btn { width: 40px; height: 40px; }
  .btn-sm { min-height: 36px; padding: 7px 12px; }
  .tab { padding: 8px 12px; }
  .act { padding: 7px 9px; }
  .side-link { padding: 11px 12px; }
  .pagination a, .pagination span { min-width: 40px; height: 40px; }
}

/* phones keep the edge-to-edge rhythm the blocks above would otherwise widen */
@media (max-width: 640px) {
  .page-grid { padding-top: 12px; padding-bottom: 32px; }
  .card-stack { gap: 8px; }
  .post-stream { gap: 8px; }
  .topic-row { padding: 10px var(--page-x); }
  .card-head { padding: 10px var(--page-x); }
  .card-body { padding: 14px var(--page-x); }
  .col-right .card-head { padding: 10px var(--page-x); }
  .col-right .card-body { padding: 14px var(--page-x); }
}

/* a reader who asked the system for less motion gets none of it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
