/*
 * Sookoo base styles. No build step: this file is served as-is.
 * Colours are tokens on :root; themes override them in themes/<name>/assets/theme.css.
 * The accent colour comes from Admin → Appearance via an inline --accent on <html>.
 */

/* ---- Tokens ----------------------------------------------------------- */

:root {
    color-scheme: light;
    --accent: #4f46e5;
    --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-text: color-mix(in srgb, var(--accent) 82%, #000);
    --accent-contrast: #fff;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e7eaef;
    --border: #e1e4ea;
    --border-strong: #c9ced8;
    --text: #1a1d23;
    --text-muted: #555f6d;
    --text-subtle: #636b78;
    --focus: color-mix(in srgb, var(--accent) 55%, transparent);

    --danger: #c8261b;
    --danger-strong: #c8261b; /* filled buttons: white text on it in both themes */
    --danger-soft: #fdecea;
    --success: #067a46;
    --success-soft: #e6f6ee;
    --warning: #9a4d00;
    --warning-soft: #fff4e0;
    --info: #1f5fbf;
    --info-soft: #e8f0fc;

    --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06);
    --shadow: 0 1px 3px rgb(16 24 40 / 0.08), 0 1px 2px rgb(16 24 40 / 0.04);
    --shadow-lg: 0 12px 32px rgb(16 24 40 / 0.14), 0 2px 6px rgb(16 24 40 / 0.06);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-full: 999px;

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --header-h: 60px;
    --gutter: 16px;
    --content-w: 1120px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --title-glow: 0 0 10px color-mix(in srgb, var(--accent-text) 60%, transparent);
        --accent-hover: color-mix(in srgb, var(--accent) 80%, #fff);
        --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
        --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
        --bg: #0e1014;
        --surface: #161920;
        --surface-2: #1c2028;
        --surface-3: #252a34;
        --border: #2a2f39;
        --border-strong: #3b414d;
        --text: #e9ebef;
        --text-muted: #a6aebb;
        --text-subtle: #7f8896;
        --danger: #ff8a80;
        --danger-strong: #b3261e;
        --danger-soft: #3a1a18;
        --success: #5fd49a;
        --success-soft: #12301f;
        --warning: #ffc266;
        --warning-soft: #352512;
        --info: #8ab4ff;
        --info-soft: #172640;
        --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
        --shadow: 0 1px 3px rgb(0 0 0 / 0.5);
        --shadow-lg: 0 16px 40px rgb(0 0 0 / 0.55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --title-glow: 0 0 10px color-mix(in srgb, var(--accent-text) 60%, transparent);
    --accent-hover: color-mix(in srgb, var(--accent) 80%, #fff);
    --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
    --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
    --bg: #0e1014;
    --surface: #161920;
    --surface-2: #1c2028;
    --surface-3: #252a34;
    --border: #2a2f39;
    --border-strong: #3b414d;
    --text: #e9ebef;
    --text-muted: #a6aebb;
    --text-subtle: #7f8896;
    --danger: #ff8a80;
    --danger-strong: #b3261e;
    --danger-soft: #3a1a18;
    --success: #5fd49a;
    --success-soft: #12301f;
    --warning: #ffc266;
    --warning-soft: #352512;
    --info: #8ab4ff;
    --info-soft: #172640;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / 0.55);
}

/* ---- Base ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

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

.skip-link {
    position: absolute; left: 12px; top: 12px; z-index: 100;
    background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm);
    transform: translateY(-200%); visibility: hidden;
}
.skip-link:focus { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }

/* ---- Page progress bar (navigation and form submits) -------------------- */

.page-progress {
    position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000;
    pointer-events: none; opacity: 0; transition: opacity .2s ease;
}
.page-progress::before {
    content: ""; display: block; height: 100%; width: 100%;
    background: var(--accent); transform-origin: left; transform: scaleX(0);
}
.page-progress.is-active { opacity: 1; }
.page-progress.is-active::before { animation: progress-grow 8s cubic-bezier(.1, .7, .3, 1) forwards; }
.page-progress.is-done::before { animation: none; transform: scaleX(1); transition: transform .2s ease; }

@keyframes progress-grow {
    0% { transform: scaleX(0); }
    20% { transform: scaleX(.45); }
    100% { transform: scaleX(.92); }
}

@media (prefers-reduced-motion: reduce) {
    /* A static, clearly visible bar instead of the animation. */
    .page-progress.is-active::before {
        animation: none; transform: scaleX(1);
        background: repeating-linear-gradient(90deg, var(--accent) 0 16px, color-mix(in srgb, var(--accent) 45%, transparent) 16px 32px);
    }
}

/* ---- Layout ------------------------------------------------------------ */

.container { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 0 var(--gutter); }
.container--narrow { max-width: 760px; }

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem; min-width: 0; }
.brand:hover { color: var(--text); }
.brand__mark {
    flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-contrast); font-size: .9rem; font-weight: 800;
}
.brand__logo { height: 32px; width: auto; display: block; }
.brand__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav__link {
    color: var(--text-muted); text-decoration: none; padding: 7px 10px; border-radius: var(--radius-sm); font-weight: 550;
}
.site-nav__link:hover, .site-nav__link[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.site-main { flex: 1; padding: 28px 0 48px; }
.site-footer { border-top: 1px solid var(--border); color: var(--text-subtle); font-size: .875rem; padding: 20px 0; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.site-footer a { color: var(--text-muted); }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header h1 { margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--text-muted); }

/* ---- Utilities ---------------------------------------------------------- */

/* Fixed gaps, not a variable: a variable would leak into a nested stack (an inner .stack-sm took its own 8px from a .stack-lg parent). */
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 24px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, 8px); }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.break-all { overflow-wrap: anywhere; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }

/* ---- Cards ---------------------------------------------------------------- */

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card__body { padding: 20px; }
.card__header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__header h2, .card__header h3 { margin: 0; }
.card__footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 16px; }
.grid-2 > .card, .grid-3 > .card { margin-top: 0; }
@media (max-width: 560px) {
    .card__body { padding: 16px; }
    .card__header, .card__footer { padding-left: 16px; padding-right: 16px; }
}

/* ---- Buttons ---------------------------------------------------------------- */

.btn {
    --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-hover: var(--surface-2);
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
    font: inherit; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
    cursor: pointer; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--btn-hover); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; transform: none; }
.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); --btn-border: transparent; --btn-hover: var(--accent-hover); }
.btn--danger { --btn-bg: var(--danger-strong); --btn-fg: #fff; --btn-border: transparent; --btn-hover: color-mix(in srgb, var(--danger-strong) 85%, #000); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; --btn-hover: var(--surface-2); box-shadow: none; }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: .875rem; }
.btn--lg { min-height: 44px; padding: 0 20px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 38px; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Loading state: spinner plus a "Saving…" label, set by app.js. */
.spinner {
    width: 16px; height: 16px; flex: none; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
.btn.is-loading { cursor: progress; opacity: .9; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; border-right-color: currentColor; border-style: dotted; }
}

.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px;
}
.link-button--danger { color: var(--danger); }

/* ---- Forms ------------------------------------------------------------------ */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field__label { font-weight: 600; font-size: .925rem; }
.field__label .optional { font-weight: 400; color: var(--text-subtle); }
.field__help { font-size: .85rem; color: var(--text-muted); margin: 0; }
.field__error { font-size: .85rem; color: var(--danger); margin: 0; display: flex; gap: 6px; align-items: flex-start; }
.field__row { display: flex; gap: 8px; align-items: center; }
.field--inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.input, .textarea, .select select {
    width: 100%; min-height: 40px; padding: 8px 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 110px; resize: vertical; }
.textarea--code { font-family: var(--font-mono); font-size: .875rem; }
.input:hover, .textarea:hover, .select select:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-subtle)); }
.input:focus, .textarea:focus, .select select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select select[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly] { background: var(--surface-2); color: var(--text-muted); cursor: default; }
.input[readonly] { background: var(--surface-2); }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }

/* Custom select: the native arrow is replaced by a chevron drawn with ::after,
   inset from the right edge, in the text colour (works in both themes and under
   a CSP that blocks data: images). */
.select { position: relative; display: block; }
.select select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    padding-right: 34px; cursor: pointer;
}
.select::after {
    content: ""; position: absolute; right: 14px; top: 50%;
    width: 7px; height: 7px; margin-top: -5px;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg); pointer-events: none;
}
.select select:disabled { opacity: .6; cursor: not-allowed; }
.select--sm select { min-height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: .875rem; }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; box-shadow: none; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin: 3px 0 0; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.check__text { display: grid; gap: 2px; }
.check__text small { color: var(--text-muted); }

/* Toggle switch built on a checkbox. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
    width: 40px; height: 24px; border-radius: 12px; background: var(--border-strong); flex: none;
    position: relative; transition: background .15s ease;
}
.switch__track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s ease;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: .5; }

.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-section + .form-section { border-top: 1px solid var(--border); padding-top: 18px; }

/* ---- Alerts, badges, toasts ---------------------------------------------------- */

.alert {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
    border: 1px solid transparent; background: var(--info-soft); color: var(--text);
}
.alert__icon { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--info); }
.alert--success { background: var(--success-soft); }
.alert--success .alert__icon { color: var(--success); }
.alert--warning { background: var(--warning-soft); }
.alert--warning .alert__icon { color: var(--warning); }
.alert--danger, .alert--error { background: var(--danger-soft); }
.alert--danger .alert__icon, .alert--error .alert__icon { color: var(--danger); }
.alert { flex-wrap: wrap; }
.alert > div { flex: 1 1 220px; min-width: 0; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert ul { padding-left: 18px; margin: 4px 0 0; }

.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full);
    font-size: .75rem; font-weight: 650; line-height: 1.5; background: var(--surface-3); color: var(--text-muted);
    white-space: nowrap;
}
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.toasts {
    position: fixed; z-index: 900; right: 16px; bottom: 16px; left: 16px;
    display: grid; gap: 8px; justify-items: end; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 420px; width: 100%;
    padding: 12px 12px 12px 14px; border-radius: var(--radius); background: var(--surface); color: var(--text);
    border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: toast-in .2s ease;
}
.toast__icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info .toast__icon { color: var(--info); }
.toast__message { flex: 1; }
.toast__close { flex: none; margin: -4px -4px -4px 0; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- Tables, lists --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; } /* contains .sr-only labels, which would otherwise widen the page */
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); font-weight: 650; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }

.dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 20px; margin: 0; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }

.stat { display: grid; gap: 4px; }
.stat__label { color: var(--text-muted); font-size: .85rem; }
.stat__value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---- Avatars --------------------------------------------------------------------- */

.avatar {
    --size: 36px; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
    display: inline-grid; place-items: center; overflow: hidden;
    background: hsl(var(--hue, 230) 55% 88%); color: hsl(var(--hue, 230) 45% 28%);
    font-weight: 700; font-size: calc(var(--size) * .38); letter-spacing: .02em; user-select: none;
}
:root[data-theme="dark"] .avatar { background: hsl(var(--hue, 230) 35% 26%); color: hsl(var(--hue, 230) 70% 86%); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .avatar { background: hsl(var(--hue, 230) 35% 26%); color: hsl(var(--hue, 230) 70% 86%); }
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--sm { --size: 28px; }
.avatar--lg { --size: 64px; }
.avatar--xl { --size: 96px; }

/* ---- Menus (details-based, work without JS) ---------------------------------------- */

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 6px;
}
.menu__header { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu__item {
    display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.menu__item:hover { background: var(--surface-2); color: var(--text); }
.menu__item svg { width: 18px; height: 18px; color: var(--text-muted); }
.menu__sep { height: 1px; background: var(--border); margin: 6px 0; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px; border-radius: var(--radius-full); }
.user-chip:hover { background: var(--surface-2); }

/* ---- Tabs / sub-navigation ------------------------------------------------------------ */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 10px 12px; color: var(--text-muted); text-decoration: none; font-weight: 600; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---- Pagination --------------------------------------------------------------------------- */

.pagination { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
    min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center;
    border-radius: var(--radius-sm); text-decoration: none; color: var(--text-muted); font-weight: 600;
}
.pagination a:hover { background: var(--surface-2); color: var(--text); }
.pagination [aria-current="page"] { background: var(--accent); color: var(--accent-contrast); }

/* ---- Empty states, skeletons ------------------------------------------------------------- */

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty__icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--text-subtle); }
.empty h2, .empty h3 { color: var(--text); }

.skeleton {
    display: block; border-radius: var(--radius-sm); min-height: 1em;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- Dialog (confirmations) --------------------------------------------------------------- */

.dialog {
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(440px, calc(100vw - 32px));
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(10 12 16 / .45); }
.dialog__body { padding: 20px; }
.dialog__body h2 { font-size: 1.1rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; }

/* ---- Auth and installer pages ----------------------------------------------------------- */

.auth { flex: 1; display: grid; place-items: center; padding: 32px var(--gutter) 48px; }
.auth__box { width: 100%; max-width: 420px; }
.auth__brand { display: flex; justify-content: center; margin-bottom: 20px; }
.auth__title { text-align: center; margin-bottom: 6px; font-size: 1.45rem; }
.auth__lead { text-align: center; color: var(--text-muted); margin-bottom: 20px; }
.auth__footer { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: .925rem; }

.steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; list-style: none; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 6px; color: var(--text-subtle); font-size: .85rem; font-weight: 600; }
.steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--border-strong); margin-right: 2px; }
.steps__num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .75rem; }
.steps [aria-current="step"] { color: var(--text); }
.steps [aria-current="step"] .steps__num { background: var(--accent); color: var(--accent-contrast); }
.steps .is-done .steps__num { background: var(--success-soft); color: var(--success); }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist__icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.checklist .ok { color: var(--success); }
.checklist .fail { color: var(--danger); }
.checklist .warn { color: var(--warning); }
.checklist__text { display: grid; }
.checklist__text small { color: var(--text-muted); }

/* ---- Admin shell ---------------------------------------------------------------------------- */

.admin { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.admin__sidebar { border-right: 1px solid var(--border); background: var(--surface); padding: 12px 10px; }
.admin__nav {
    display: grid; gap: 2px;
    position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
}
.admin__nav-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); padding: 12px 10px 4px; }
.admin__nav a {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none; font-weight: 550; font-size: .9rem;
}
.admin__nav a svg { width: 16px; height: 16px; flex: none; }
.admin__nav a:hover { background: var(--surface-2); color: var(--text); }
.admin__nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.admin__content { padding: 24px 24px 48px; min-width: 0; }
.admin__content > .container { padding: 0; }

@media (max-width: 860px) {
    .admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .admin__sidebar {
        position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px var(--gutter);
        overflow-x: auto; scrollbar-width: none;
    }
    .admin__sidebar::-webkit-scrollbar { display: none; }
    .admin__nav { display: flex; gap: 4px; position: static; max-height: none; overflow: visible; }
    .admin__nav-label { display: none; }
    .admin__nav a { white-space: nowrap; }
    .admin__content { padding: 20px var(--gutter) 40px; }
}

/* ---- Sub-navigation: a list of a page's cards on the left, the chosen card on the right ---- */

.subnav-layout { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav-layout--single { grid-template-columns: minmax(0, 720px); }
.subnav-layout__panels { display: grid; gap: 16px; min-width: 0; }
/* Form cards stay a readable width; cards holding tables or long values (.card--wide) take the rest. */
.subnav-layout__panels > .card { margin: 0; max-width: 720px; }
.subnav-layout__panels > .card--wide { max-width: none; }
/* Room to breathe in the cards' text. */
.subnav-layout__panels :is(.card__body, .panel__body) :is(p, li) { line-height: 1.6; }
.subnav-layout__panels .setting__help { line-height: 1.55; }
.subnav-layout__panels :is(.card__body, .panel__body) :is(ol, ul):not(.list) > li + li { margin-top: 4px; }
.subnav-layout__panels .copy-field { margin-top: 4px; }
/* With script, only the chosen card shows; without it, all of them do. */
.subnav-layout.is-ready [data-subnav-panel]:not(.is-current) { display: none; }
.subnav { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.subnav__heading { margin: 10px 10px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.subnav__heading:first-child { margin-top: 4px; }
.subnav__link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; font-weight: 550; font-size: .9rem; }
.subnav__link:hover { background: var(--surface-2); color: var(--text); }
.subnav__link[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); }
.subnav__hint { flex: none; font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.subnav__link[aria-current="true"] .subnav__hint { color: inherit; }
@media (max-width: 760px) {
    .subnav-layout { grid-template-columns: minmax(0, 1fr); }
    /* A row of chips that scrolls sideways, like the admin menu on phones. */
    .subnav { position: static; display: flex; overflow-x: auto; scrollbar-width: none; padding: 6px; }
    .subnav::-webkit-scrollbar { display: none; }
    .subnav__heading { display: none; }
    .subnav__link { white-space: nowrap; flex: none; }
}

/* ---- Settings rows ----------------------------------------------------------------------------- */

/* Settings pages: titled panels, two side by side when there's room.
   Each row is the label (and help) above its control; switches, numbers and
   colours sit on the same line as the label. */
.contents { display: contents; }
.settings-panels { columns: 2 360px; column-gap: 16px; }
.settings-panels--single { columns: auto; max-width: 720px; }
.settings-panels .card { break-inside: avoid; margin: 0 0 16px; }
.settings-panels + .card { margin-top: 16px; }
.panel__header { padding: 11px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* One look for every admin card title: settings panels and the other admin pages' cards. */
.panel__header h2, .admin .card__header h2, .admin .card__header h3 { margin: 0; font-size: .95rem; font-weight: 650; color: var(--accent-text); text-shadow: var(--title-glow, 0 0 8px color-mix(in srgb, var(--accent) 35%, transparent)); }
.panel__body { padding: 2px 16px; }
.panel__body.stack, .panel__body.form { padding-top: 12px; padding-bottom: 12px; }
.panel__footer { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.setting { display: grid; gap: 6px; padding: 12px 0; }
.panel__body > .setting:first-child { padding-top: 14px; }
.panel__body > .setting:last-child { padding-bottom: 14px; }
.setting--inline { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
.setting__meta { display: grid; gap: 2px; align-content: start; }
.setting__label { font-weight: 600; font-size: .9rem; }
.setting__help { color: var(--text-muted); font-size: .8125rem; line-height: 1.45; margin: 0; overflow-wrap: anywhere; }
.setting__meta .badge { margin-top: 4px; }
.setting__control { display: grid; gap: 6px; align-content: start; min-width: 0; }
.setting--inline .setting__control { justify-items: end; }
.setting--inline .field__error { grid-column: 1 / -1; }

.input--sm, .select .input--sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: .9rem; }
.textarea.input--sm { min-height: 76px; }
.input--num { width: 96px; text-align: right; }
.settings-panels .color-field input[type="color"] { width: 40px; height: 34px; }

/* Title and Save stay in view while scrolling a long settings page. */
.page-header--sticky {
    position: sticky; top: var(--header-h); z-index: 5; align-items: center;
    background: var(--bg); margin: -12px 0 12px; padding: 12px 0;
}
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; padding: 14px 0 8px; font-size: .9rem; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.table--compact td { padding: 4px 8px; }
.page-header--sticky h1 { font-size: 1.35rem; }
.page-header--sticky p { font-size: .9rem; }
@media (max-width: 560px) {
    .page-header--sticky { flex-wrap: nowrap; align-items: flex-start; }
    .page-header--sticky h1 { font-size: 1.2rem; }
    .page-header--sticky p { font-size: .8125rem; }
    .page-header--sticky .btn { min-height: 34px; padding: 0 12px; font-size: .875rem; flex: none; }
}

/* ---- Profile ------------------------------------------------------------------------------------ */

.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-head__name { margin: 0; }
.profile-head__meta { color: var(--text-muted); margin: 4px 0 0; }

/* ---- Home ------------------------------------------------------------------------------------------ */

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 8px; }
.hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; }

/* ---- Misc --------------------------------------------------------------------------------------- */

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--font-mono); font-size: .85rem; }
.secret-box { font-family: var(--font-mono); font-size: 1rem; letter-spacing: .08em; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: var(--font-mono); padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.qr { width: 184px; height: 184px; padding: 8px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.qr svg { display: block; width: 100%; height: 100%; }
.image-preview { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.image-preview__frame { width: 120px; height: 64px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.image-preview__frame img { max-width: 100%; max-height: 100%; }
.image-preview__frame--wide { width: 240px; height: 126px; }
.image-setting { grid-template-columns: 96px minmax(0, 1fr); column-gap: 14px; align-items: start; }
.image-setting__thumb { width: 96px; height: 56px; }
.image-setting__thumb.image-preview__frame--wide { width: 96px; height: 50px; }
.image-setting__actions { margin-top: 6px; gap: 8px; }
.image-setting__actions .cluster { gap: 6px; flex-wrap: nowrap; }
.input--file { max-width: min(210px, 100%); padding-left: 6px; font-size: .8125rem; }
.input--file.w-full { max-width: 100%; }

/* ---- Forum: header extras ------------------------------------------------------------------ */

.site-search { flex: 1; max-width: 360px; margin-left: 16px; position: relative; }
.site-search .input { min-height: 36px; padding-left: 34px; background: var(--surface-2); border-color: transparent; }
.site-search .input:focus { background: var(--surface); }
.site-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
@media (max-width: 720px) { .site-search { display: none; } [data-mobile-search] { display: inline-grid !important; place-items: center; } }
.bell { position: relative; }
.bell__count {
    position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center;
}

/* ---- Forum: layout and lists ------------------------------------------------------------- */

.forum-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .forum-layout { grid-template-columns: minmax(0, 1fr); } }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; color: var(--text-subtle); margin-bottom: 8px; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }

.category-row { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.category-row:last-child { border-bottom: 0; }
.category-row__swatch { align-self: stretch; border-radius: 3px; background: var(--cat, var(--accent)); }
.category-row__name { font-weight: 650; font-size: 1.02rem; color: var(--text); text-decoration: none; }
.category-row__name:hover { color: var(--accent-text); }
.category-row__desc, .category-desc { font-style: italic; }
.category-row__desc { color: var(--text-muted); font-size: .9rem; margin: 2px 0 0; }
.inline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; }
.inline-list > li { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
/* The dot trails each item, so a wrapped line never starts with one. Between subcategories it takes the category's colour. */
.inline-list > li:not(:last-child)::after { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--text-subtle); margin: 0 10px; }
.category-row__subs > li:not(:last-child)::after { background: var(--cat, var(--text-subtle)); }
.category-row__subs { margin-top: 6px; font-size: .88rem; }
.category-row__sub { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.category-row__sub:hover { color: var(--accent-text); text-decoration: underline; }
.category-row__stats { text-align: right; font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.category-row__stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .category-row { grid-template-columns: 4px minmax(0, 1fr); } .category-row__stats { grid-column: 2; text-align: left; } }

.thread-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.thread-row:last-child { border-bottom: 0; }
.thread-row__title { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.thread-row__title:hover { color: var(--accent-text); }
.thread-row.is-unread .thread-row__title { font-weight: 750; }
.thread-row__trail::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--cat, var(--accent)); margin-right: 4px; vertical-align: 1px; }
.thread-row__crumb { font-weight: 600; color: var(--text-muted); text-decoration: none; }
.thread-row__crumb:hover { color: var(--accent-text); text-decoration: underline; }
.thread-row__sep { margin: 0 6px; color: var(--text-subtle); }
.thread-row__meta { font-size: .84rem; color: var(--text-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.thread-row__meta a { color: inherit; }
.thread-row__stats { text-align: right; font-size: .84rem; color: var(--text-muted); white-space: nowrap; }
.thread-row__stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.cat-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--cat, var(--accent)); }
@media (max-width: 560px) {
    .thread-row { grid-template-columns: auto minmax(0, 1fr); padding: 14px 16px; }
    .thread-row__stats { display: none; }
}

/* ---- Forum: posts ------------------------------------------------------------------------- */

.post { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); }
.post:last-child { border-bottom: 0; }
.post:target { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.post__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.post__author { font-weight: 650; color: var(--text); text-decoration: none; }
.post__meta { font-size: .82rem; color: var(--text-subtle); }
.post__meta a { color: inherit; text-decoration: none; }
.post__meta a:hover { text-decoration: underline; }
.post__actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 12px; }
.post__removed { color: var(--text-subtle); font-style: italic; }
.post.is-new { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 560px) { .post { grid-template-columns: 1fr; gap: 8px; padding: 16px; } .post__avatar { display: none; } }

.reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction {
    display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px; border-radius: var(--radius-full);
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: inherit; font-size: .85rem; cursor: pointer;
}
.reaction:hover { border-color: var(--border-strong); color: var(--text); }
.reaction[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); }
.reaction__count { font-variant-numeric: tabular-nums; font-weight: 600; }
.reaction[disabled] { cursor: default; opacity: 1; }
.reaction-picker .menu__panel { min-width: 0; display: flex; gap: 2px; padding: 4px; left: 0; right: auto; }
.reaction-picker .menu__item { justify-content: center; width: 40px; height: 40px; padding: 0; font-size: 1.25rem; }

/* Rendered Markdown. */
.prose { overflow-wrap: anywhere; line-height: 1.65; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.3em 0 .5em; }
.prose h1 { font-size: 1.35rem; } .prose h2 { font-size: 1.2rem; } .prose h3 { font-size: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .25em; }
.prose li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.4em; }
.prose blockquote { border-left: 3px solid var(--border-strong); padding: 4px 0 4px 14px; color: var(--text-muted); }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); }
.prose pre code { background: none; padding: 0; font-size: .875rem; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; }
.prose th { background: var(--surface-2); }
.prose hr { margin: 1.5em 0; }
.prose a.mention { font-weight: 600; text-decoration: none; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }

/* ---- Editor -------------------------------------------------------------------------------- */

.editor { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.editor__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor__tabs { display: flex; gap: 2px; margin-right: 8px; }
.editor__tab { background: none; border: 0; font: inherit; font-size: .85rem; font-weight: 600; color: var(--text-muted); padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.editor__tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.editor__tool { background: none; border: 0; color: var(--text-muted); width: 32px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 700; }
.editor__tool:hover { background: var(--surface-3); color: var(--text); }
.editor__tool svg { width: 16px; height: 16px; }
.editor__sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.editor textarea { display: block; width: 100%; min-height: 180px; border: 0; border-radius: 0; padding: 12px 14px; resize: vertical; font: inherit; line-height: 1.6; background: transparent; color: var(--text); }
.editor textarea:focus { outline: none; box-shadow: none; }
.editor__preview { min-height: 180px; padding: 12px 14px; }
.editor__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-subtle); }
.editor__status { min-height: 1em; }

/* ---- Live "new replies" bar and shortcuts dialog --------------------------------------------- */

.live-bar {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 800;
    display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--radius-full);
    background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600;
    animation: toast-in .2s ease;
}
.live-bar .btn { --btn-bg: var(--bg); --btn-fg: var(--text); --btn-border: transparent; --btn-hover: var(--surface-2); border-radius: var(--radius-full); }
.post.is-focused { box-shadow: inset 3px 0 0 var(--accent); }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kbd-list dt { text-align: right; }
.kbd-list dd { margin: 0; }
kbd {
    display: inline-block; min-width: 24px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong);
    border-bottom-width: 2px; background: var(--surface-2); font-size: .8rem; text-align: center;
}

/* ---- Tags, pending posts, bookmarks ------------------------------------------------------------ */

.tag {
    display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--radius-full);
    font-size: .78rem; font-weight: 600; text-decoration: none;
    background: color-mix(in srgb, var(--tag, var(--text-subtle)) 14%, transparent);
    color: color-mix(in srgb, var(--tag, var(--text-muted)) 75%, var(--text));
}
.tag:hover { background: color-mix(in srgb, var(--tag, var(--text-subtle)) 24%, transparent); color: var(--text); }
.post.is-pending { background: color-mix(in srgb, var(--warning-soft) 60%, transparent); }
[data-bookmark] [aria-pressed="true"] { color: var(--accent-text); }
[data-bookmark] [aria-pressed="true"] svg { fill: currentColor; }

/* ---- Editor extras: suggestions, emoji, uploads ----------------------------------------------- */

.editor { position: relative; }
.suggest {
    position: absolute; z-index: 70; min-width: 220px; max-width: 320px; max-height: 260px; overflow-y: auto;
    margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.suggest li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); }
.suggest .avatar { --size: 24px; }
.suggest small { color: var(--text-muted); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.emoji-grid button { font-size: 1.25rem; line-height: 1; height: 36px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--surface-3); }
.editor.is-dragging { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.editor__status { display: inline-flex; align-items: center; gap: 6px; }
.editor__status .spinner { width: 12px; height: 12px; }
.post.is-sending { opacity: .75; }
.post.is-sending .avatar { --size: 63px; }
.post.is-new { animation: post-in .4s ease; }
@keyframes post-in { from { background: var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .post.is-new { animation: none; } }

/* ---- Notifications popover ----------------------------------------------------------------- */

.popover {
    position: absolute; top: calc(var(--header-h) - 6px); right: var(--gutter); z-index: 60;
    width: min(380px, calc(100vw - 2 * var(--gutter))); max-height: 70vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.popover__head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.popover__list { list-style: none; margin: 0; padding: 4px; }
.popover__list a { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .9rem; }
.popover__list a:hover { background: var(--surface-2); }
.popover__list .is-unread a { background: var(--accent-soft); }
.popover__list small { color: var(--text-muted); }
.popover__skeleton { display: grid; gap: 10px; padding: 14px; }
.popover__skeleton .skeleton { height: 34px; }
.site-header__inner { position: relative; }
/* Group colours are picked by admins, so they mark a dot rather than colour the text. */
.badge__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }

/* ---- Member badges ------------------------------------------------------------------------- */

/* The admin-picked colour (--badge) tints the background and border only, so text stays readable in both themes. */
.user-badge {
    --badge: var(--text-subtle);
    display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 11px; border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--badge) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--badge) 45%, transparent);
    color: var(--text); font-size: .75rem; font-weight: 650; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-badge__icon { font-size: .85rem; line-height: 1; }
.user-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.user-badges--stacked { flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 12px; }
.user-badges--stacked .user-badge { font-size: .72rem; padding: 3px 10px; }
/* Author column: a 63px avatar (36px + 75%) with the member's badges under it. */
.post { grid-template-columns: 150px minmax(0, 1fr); }
.post__avatar { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.post__avatar > .avatar { --size: 63px; }
.post__author--side { margin-top: 8px; max-width: 100%; text-align: center; overflow-wrap: anywhere; line-height: 1.3; }
.post__groups { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }
.post__groups .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.post__head-author { display: none; }
@media (max-width: 560px) {
    .post { grid-template-columns: 1fr; }
    .post__avatar { display: none; }
    .post__head-author { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
}
.user-badge-picker { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.disclosure { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.disclosure > summary { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* Post actions stay quiet until you reach for them. A muted colour rather than
   transparency keeps the labels above 4.5:1 contrast in both themes. */
.post__actions .btn--ghost { color: var(--text-subtle); transition: color .15s, background-color .15s; }
.post__actions .btn--ghost:hover,
.post__actions .btn--ghost:focus-visible,
.post__actions .btn--ghost[aria-pressed="true"],
.post__actions details[open] > .btn--ghost { color: var(--text); }
/* Toggles that are on (pinned, bookmarked) keep the accent colour. */
.post__actions .btn--ghost[aria-pressed="true"] { color: var(--accent-text); }
@media (prefers-reduced-motion: reduce) { .post__actions .btn--ghost { transition: none; } }
/* The body column fills the row, so actions sit at the bottom even when the author column is taller. */
.post__body { min-width: 0; display: flex; flex-direction: column; }
.post__body > .post__actions { margin-top: auto; padding-top: 12px; }

/* ---- Chat box (home page sidebar, desktop only) --------------------------------------------- */

.chatbox { display: flex; flex-direction: column; }
.chatbox__live { display: inline-flex; align-items: center; gap: 6px; }
.chatbox__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); animation: chat-pulse 2s infinite; }
@keyframes chat-pulse { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chatbox__list { margin: 0; padding: 8px 4px 8px 12px; height: 340px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; }
.chatbox__list:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chatbox__empty { margin: auto; text-align: center; }
.chat-msg { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 4px; border-radius: var(--radius-sm); }
.chat-msg:hover { background: var(--surface-2); }
.chat-msg.is-removing { opacity: .4; }
.chat-msg__meta { display: flex; align-items: baseline; gap: 6px; font-size: .78rem; line-height: 1.3; }
.chat-msg__name { font-weight: 650; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg__name:hover { text-decoration: underline; }
.chat-msg__meta time { color: var(--text-subtle); white-space: nowrap; }
.chat-msg__text { margin: 2px 0 0; font-size: .875rem; line-height: 1.4; overflow-wrap: anywhere; }
.chat-msg__delete { width: 26px; min-height: 26px; color: var(--text-subtle); opacity: 0; }
.chat-msg:hover .chat-msg__delete, .chat-msg__delete:focus-visible { opacity: 1; }
.chat-msg__delete svg { width: 14px; height: 14px; }
.chatbox__footer { border-top: 1px solid var(--border); padding: 10px 12px; }
.chatbox__form { display: flex; gap: 6px; }
.chatbox__form .input { min-height: 38px; }
@media (max-width: 960px) { .chatbox { display: none; } }
@media (prefers-reduced-motion: reduce) { .chatbox__dot { animation: none; } }

/* ---- Sookoo branding ------------------------------------------------------------------------ */

.sookoo-logo { display: block; height: 36px; width: auto; color: var(--text); }
.powered-by { display: inline-flex; align-items: center; gap: 5px; }
.powered-by img { display: block; }

/* ---- Notice bar (top of every page) --------------------------------------------------------- */

.notice-bar { --tone: var(--info); background: color-mix(in srgb, var(--tone) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); color: var(--text); font-size: .9rem; }
.notice-bar--success { --tone: var(--success); }
.notice-bar--warning { --tone: var(--warning); }
.notice-bar--danger { --tone: var(--danger); }
.notice-bar__inner { display: flex; align-items: center; gap: 10px; min-height: 42px; padding-top: 6px; padding-bottom: 6px; }
.notice-bar__icon { flex: none; color: var(--tone); }
.notice-bar__text { margin: 0; flex: 1; min-width: 0; }
.notice-bar__text a, .notice-bar__link { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.notice-bar__link { flex: none; font-size: .85rem; }
.notice-bar__close { flex: none; margin-right: -8px; color: var(--text-muted); }
[data-dismissible].is-dismissing { opacity: 0; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { [data-dismissible].is-dismissing { transition: none; } }

/* ---- Welcome card (top of the home page) ---------------------------------------------------- */

.welcome-card { margin-bottom: 20px; border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)) 0%, var(--surface) 60%); }
.welcome-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.welcome-card__title { margin: 0 0 6px; font-size: 1.3rem; }
.welcome-card__body > :last-child { margin-bottom: 0; }

/* ---- Two-column editor with a live preview (admin) ------------------------------------------ */

.live-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.live-editor.is-preview-hidden { grid-template-columns: minmax(0, 1fr); }
.live-editor.is-preview-hidden .live-editor__preview { display: none; }
/* Sticky below the site header, which stays at the top of the window. */
.live-editor__header { position: sticky; top: var(--header-h); z-index: 5; background: var(--bg); padding-top: 8px; padding-bottom: 8px; margin-top: -8px; }
.live-editor__preview { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; height: calc(100vh - var(--header-h) - 32px); min-height: 480px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.live-editor__toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); }
.live-editor__stage { position: relative; flex: 1; overflow: hidden; background: var(--surface-2); }
.live-editor__frame { position: absolute; top: 0; left: 0; border: 0; background: var(--bg); transform-origin: 0 0; }
.live-editor__stage.is-phone .live-editor__frame { box-shadow: 0 0 0 1px var(--border), var(--shadow-lg); }
.live-editor__placeholder, .live-editor__error { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 24px; text-align: center; color: var(--text-muted); background: var(--surface-2); }
.live-editor__placeholder[hidden], .live-editor__error[hidden] { display: none; }
.segmented { display: inline-flex; padding: 2px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.segmented__item { display: inline-grid; place-items: center; width: 32px; height: 28px; border: 0; border-radius: calc(var(--radius-sm) - 2px); background: transparent; color: var(--text-muted); cursor: pointer; }
.segmented__item[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.segmented__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 1100px) {
    .live-editor { grid-template-columns: minmax(0, 1fr); }
    .live-editor__preview { position: static; height: 640px; }
    .live-editor__header { position: static; }
}
.breadcrumbs__home { display: inline-flex; align-items: center; gap: 5px; }
.breadcrumbs__home .icon { width: 15px; height: 15px; vertical-align: 0; }

/* ---- Pinned replies ------------------------------------------------------------------------- */

.pinned-replies { margin: 0 20px 4px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.pinned-replies__title { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: .9rem; color: var(--text-muted); }
.pinned-replies__title .icon { color: var(--accent); }
.pinned-replies__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pinned-reply { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.pinned-reply + .pinned-reply { padding-top: 12px; border-top: 1px solid var(--border); }
.pinned-reply__meta { margin: 0; font-size: .85rem; }
.pinned-reply__excerpt { margin: 2px 0 4px; font-size: .9rem; }
.post.is-pinned { box-shadow: inset 3px 0 0 var(--accent); }
.post__pinned { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--accent-text); font-weight: 600; }
.post__pinned .icon { width: 13px; height: 13px; }
@media (max-width: 560px) { .pinned-replies { margin: 0 16px 4px; } }

/* ---- Discussions listed under each category on the home page --------------------------------- */

.category-row { align-items: start; }
.category-threads { margin-top: 8px; font-size: .9rem; }
.category-threads__title { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-threads__title:hover { color: var(--accent-text); text-decoration: underline; }
.category-threads .is-unread .category-threads__title { font-weight: 650; }

/* ---- Home sidebar: useful tools card ------------------------------------------------------- */

.tool-links { list-style: none; margin: 0; padding: 6px; }
.tool-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .92rem; }
.tool-link:hover { background: var(--surface-2); }
.tool-link__icon { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 1rem; color: var(--text-muted); }
.tool-link__icon .icon { width: 15px; height: 15px; }
.tool-link__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-link__ext { width: 14px; height: 14px; color: var(--text-subtle); }

/* ---- Admin: arranging cards and editing link rows ----------------------------------------- */

.arrange { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.arrange__item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 8px 8px 14px; background: var(--surface); }
.arrange__item + .arrange__item { border-top: 1px solid var(--border); }
.arrange__item.is-moved { background: var(--accent-soft); transition: background-color .6s; }
.arrange__buttons { margin-left: auto; display: inline-flex; gap: 2px; }
.arrange__item:first-child [data-arrange-move="up"], .arrange__item:last-child [data-arrange-move="down"] { visibility: hidden; }
.tool-rows { display: grid; gap: 6px; }
.tool-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px; }
.tool-row__icon { text-align: center; }
.segmented--text .segmented__item { width: auto; padding: 0 10px; font-size: .8rem; font-weight: 600; }
.segmented__item:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.segmented__item:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 560px) { .tool-row { grid-template-columns: 56px minmax(0, 1fr); } .tool-row > :last-child { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) { .arrange__item.is-moved { transition: none; } }
.arrange__item { padding-left: 6px; }
.arrange__handle { display: inline-grid; place-items: center; width: 24px; height: 32px; border-radius: var(--radius-sm); color: var(--text-subtle); cursor: grab; touch-action: none; user-select: none; }
.arrange__handle:hover { color: var(--text); background: var(--surface-2); }
.arrange.is-sorting, .arrange.is-sorting * { cursor: grabbing; user-select: none; }
.arrange__item.is-dragging { position: relative; z-index: 1; background: var(--surface); box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); outline: 2px solid var(--accent); }

/* ---- Collapsible cards (details.card) ------------------------------------------------------ */

.collapsible > .collapsible__summary { list-style: none; cursor: pointer; user-select: none; gap: 12px; }
.collapsible > .collapsible__summary::-webkit-details-marker { display: none; }
.collapsible:not([open]) > .collapsible__summary { border-bottom: 0; }
.collapsible__summary:hover h2 { color: var(--accent-text); }
.collapsible__summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.collapsible__hint { margin-left: auto; font-size: .85rem; color: var(--text-muted); font-weight: 500; }
/* Chevron drawn with borders (no data: images under the CSP). Points down when closed, up when open. */
.collapsible__summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 4px 0; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .15s; }
.collapsible[open] > .collapsible__summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
@media (prefers-reduced-motion: reduce) { .collapsible__summary::after { transition: none; } }

/* ---- On/off status (admin) ------------------------------------------------------------------ */

.status { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 6px; border-radius: var(--radius-full); font-size: .8rem; font-weight: 650; }
.status .icon { width: 15px; height: 15px; }
.status--on { background: var(--success-soft); color: var(--success); }
.status--off { background: var(--surface-2); color: var(--text-muted); }
.status--on .status__icon--off, .status--off .status__icon--on { display: none; }
.status__icon { display: inline-grid; }

/* ---- Secret blocks in posts ------------------------------------------------------------------ */

.secret { margin: 0 0 1em; border: 1px dashed color-mix(in srgb, var(--warning) 55%, var(--border)); border-radius: var(--radius-sm);
    background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warning) 6%, var(--surface)) 0 8px, var(--surface) 8px 16px); }
.secret__bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; }
.secret__icon { color: var(--warning); }
.secret__label { flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.secret__note { font-size: .8rem; color: var(--text-muted); }
.secret__reveal { flex: none; }
.secret__body { padding: 10px 14px 12px; border-top: 1px dashed color-mix(in srgb, var(--warning) 40%, var(--border)); background: var(--surface); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.secret__body > :last-child { margin-bottom: 0; }
.editor__menu { position: relative; }
.editor__menu > summary { list-style: none; }
.editor__menu > summary::-webkit-details-marker { display: none; }
.editor__menu .menu__panel { min-width: 220px; left: 0; right: auto; }
.menu__heading { margin: 4px 10px 6px; font-size: .78rem; font-weight: 650; color: var(--text-muted); }
.secret__expiry { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.secret__expiry .icon { width: 13px; height: 13px; }
.secret.is-expired { background: var(--surface-2); border-style: dashed; }
.secret.is-expired .secret__icon { color: var(--text-subtle); }
.secret.is-expired .secret__label { color: var(--text-muted); }

/* ---- Notes ---------------------------------------------------------------------------------- */

.note__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.note__author { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; }
.note__time { color: inherit; text-decoration: none; }
.note__time:hover { text-decoration: underline; }
.note__title { margin: 0 0 6px; font-size: 1.15rem; }
.note__title a { color: var(--text); text-decoration: none; }
.note__title a:hover { color: var(--accent-text); }
.note--single .note__title { font-size: 1.5rem; }
.note__body[data-clamp] { max-height: 16em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.note__more { display: inline-block; margin-top: 6px; }
.note-visibility .icon { width: 13px; height: 13px; }
.note-visibility--public { background: var(--success-soft); color: var(--success); }
.note-visibility--private { background: var(--surface-2); }
.note-groups { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }

/* ---- Installer: database choice cards -------------------------------------------------------- */

.db-choices { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.db-choice { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.db-choice:hover { border-color: var(--border-strong); }
.db-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.db-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.db-choice:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.db-choice input { margin: 3px 0 0; accent-color: var(--accent); width: 18px; height: 18px; }
.db-choice__body { display: grid; gap: 4px; min-width: 0; }
.db-choice__title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 1.02rem; }
.db-choice__lead { color: var(--text-muted); font-size: .9rem; }
.db-choice__lists { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 6px; font-size: .85rem; }
.db-choice__lists > span { display: grid; gap: 3px; align-content: start; }
.db-choice__pros, .db-choice__cons { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; }
.db-choice__pros { color: var(--success); }
.db-choice__cons { color: var(--warning); }
.db-choice__pros .icon, .db-choice__cons .icon { width: 14px; height: 14px; }
.db-choice__item { color: var(--text-muted); padding-left: 19px; position: relative; }
.db-choice__item::before { content: ""; position: absolute; left: 6px; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.db-choice__note { color: var(--danger); font-size: .85rem; }
@media (max-width: 560px) { .db-choice__lists { grid-template-columns: 1fr; } }

/* ---- Image uploads in the editor ------------------------------------------------------------ */

.uploads { border-top: 1px solid var(--border); padding: 8px 12px; display: grid; gap: 8px; }
.uploads__drop { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .85rem; color: var(--text-muted); }
.uploads__drop .icon { color: var(--text-subtle); }
.uploads__hint { flex-basis: 100%; font-size: .78rem; color: var(--text-subtle); padding-left: 26px; }
.editor.is-dragging .uploads { background: var(--accent-soft); }
.editor.is-dragging .uploads__drop { color: var(--accent-text); }
.uploads__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.uploads__list:empty { display: none; }
.upload { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.upload__thumb { width: 56px; height: 56px; object-fit: cover; border-radius: calc(var(--radius-sm) - 2px); background: var(--surface-2); }
.upload__body { display: grid; gap: 4px; min-width: 0; }
.upload__name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload__progress { width: 100%; height: 6px; accent-color: var(--accent); }
.upload__alt { min-height: 32px; padding: 4px 8px; font-size: .85rem; }
.upload.needs-alt .upload__alt { border-color: color-mix(in srgb, var(--warning) 60%, var(--border)); }
.upload.is-working .upload__thumb { opacity: .6; }
.upload.is-failed { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.upload.is-failed .upload__state { color: var(--danger); }
.upload__remove { font-size: 1.2rem; line-height: 1; }

/* ---- Site background photo (Unsplash) ------------------------------------------------------- */

/* A tint in the theme's own background colour keeps text on the page readable in both themes. */
html[data-site-bg] { --bg-tint: 82%; }
html[data-site-bg="light"] { --bg-tint: 70%; }
html[data-site-bg="strong"] { --bg-tint: 90%; }
html[data-site-bg] body {
    background-color: var(--site-bg-color, var(--bg));
    background-image: linear-gradient(color-mix(in srgb, var(--bg) var(--bg-tint), transparent), color-mix(in srgb, var(--bg) var(--bg-tint), transparent)), var(--site-bg-lg);
    background-size: cover; background-position: center; background-attachment: fixed;
}
@media (max-width: 760px) {
    /* Smaller photo, and no fixed attachment (janky on phones). */
    html[data-site-bg] body {
        background-image: linear-gradient(color-mix(in srgb, var(--bg) var(--bg-tint), transparent), color-mix(in srgb, var(--bg) var(--bg-tint), transparent)), var(--site-bg-sm);
        background-attachment: scroll;
    }
}
html[data-site-bg] .site-footer { background: color-mix(in srgb, var(--bg) 92%, transparent); }
.site-footer__credit a { color: inherit; }

/* Admin: picking a photo. */
.bg-current { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.bg-current__thumb { width: 160px; height: 100px; object-fit: cover; border-radius: var(--radius-sm); }
.unsplash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.unsplash-skeleton { display: block; height: 110px; border-radius: var(--radius-sm); }
.unsplash-card { margin: 0; display: grid; gap: 4px; }
.unsplash-card__pick { position: relative; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: none; display: block; }
.unsplash-card__pick img { display: block; width: 100%; height: 110px; object-fit: cover; }
.unsplash-card__use { position: absolute; inset: auto 0 0 0; padding: 6px 8px; font-size: .78rem; font-weight: 650; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .15s; text-align: left; }
.unsplash-card__pick:hover .unsplash-card__use, .unsplash-card__pick:focus-visible .unsplash-card__use, .unsplash-card__pick.is-loading .unsplash-card__use { opacity: 1; }
.unsplash-card__pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.unsplash-card figcaption { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unsplash-card figcaption a { color: inherit; }
[data-unsplash-more] { margin-top: 10px; }
@media (max-width: 640px) { .bg-current { grid-template-columns: 1fr; } .bg-current__thumb { width: 100%; height: 140px; } }
@media (prefers-reduced-motion: reduce) { .unsplash-card__use { transition: none; } }
