/* ── Themes ───────────────────────────────────────────────────────────────
   Neutral, low-saturation palettes with a single restrained blue accent.
   Color is reserved for state (success / warning / danger) and data. */

/* Dark (default) — graphite */
:root {
    --bg-darker: #0f1115;
    --bg-main: #14171c;
    --bg-card: #1b1f25;
    --bg-tertiary: #242931;
    /* Two blues with two jobs. --primary fills buttons and marks what is chosen: white words read on it
       (4.5:1, tests/test_ui_standards.py). --accent is the same blue as words and icons on the page (links,
       the current page in the menu): a step lighter, so it reads on the cards. Never --primary as text. */
    --primary: #3774c7;
    --primary-hover: #3066af;
    --on-primary: #fff;      /* words on a --primary fill; a theme whose button color is light gets dark ones (appearance.js) */
    --accent: #5b92dc;
    --accent-rgb: 91, 146, 220;
    --accent-alpha: rgba(91, 146, 220, 0.12);
    --text-main: #e8eaed;
    --text-normal: #c3c8cf;
    --text-muted: #8b939e;
    /* The quietest words (group names in the menu, "Off"): a step under --text-muted, and still readable.
       Worked out from the look's own secondary text, so a server's theme gets one that fits it. */
    --text-dark: color-mix(in srgb, var(--text-muted) 91%, #1b1f25);
    --success: #2f9e5b;
    --warning: #c98a1a;
    --danger: #d64545;
    /* The status colors as words. The plain ones above are for fills, dots, bars and borders; as words on a
       dark card they are too dim, so these are a step toward white (and read on a tinted chip too). */
    --success-text: color-mix(in srgb, var(--success) 82%, #fff);
    --warning-text: color-mix(in srgb, var(--warning) 90%, #fff);
    --danger-text: color-mix(in srgb, var(--danger) 74%, #fff);
    /* Equinox Premium's gold: the crown beside what only Premium opens (core.js premiumBadge) */
    --premium: #e3a92b;
    --premium-text: color-mix(in srgb, var(--premium) 85%, #fff);
    --border-color: rgba(255, 255, 255, 0.07);
    --border: var(--border-color);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --nav-active-bg: rgba(91, 146, 220, 0.1);
    /* The height of a button, a field, a dropdown and a row of segmented tabs, so a row of them is level */
    --control-height: 2.25rem;
    /* The longest line of running text. Past about a hundred letters the eye loses its place going back to
       the start of the next line, and on a wide screen help lines ran to 150 and more. */
    --measure: 90ch;
    --focus-ring: rgba(91, 146, 220, 0.25);
    --shadow-primary: rgba(0, 0, 0, 0.25);
    --switch-off: rgba(120, 120, 128, 0.36);
    --scrollbar: rgba(255, 255, 255, 0.14);
    /* Boxes that float: dialogs sit on a dimmed page and barely need a shadow (a large one
       shows as a dark smudge around them); menus and notices need a little more */
    --shadow-dialog: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-float: 0 6px 16px rgba(0, 0, 0, 0.28);
    /* The dashboard's font; a server theme can pick another (see "Theme pictures" below) */
    --font-ui: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Browser-drawn parts (scrollbars, select lists, number arrows) follow the theme */
    color-scheme: dark;
}

/* Midnight — pure black for OLED displays */
[data-theme="amoled"] {
    --bg-darker: #000000;
    --bg-main: #070708;
    --bg-card: #111214;
    --bg-tertiary: #1b1c1f;
    --primary: #3774c7;
    --primary-hover: #3066af;
    --accent: #5b92dc;
    --text-main: #f1f2f4;
    --text-normal: #c9ccd1;
    --text-muted: #8e939b;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-shadow: none;
}

/* Navy — dark with a cool blue-gray cast */
[data-theme="blue"] {
    --bg-darker: #0b1220;
    --bg-main: #101828;
    --bg-card: #172133;
    --bg-tertiary: #1f2b40;
    --primary: #3774c7;
    --primary-hover: #3066af;
    --accent: #6a9ee0;
    --accent-rgb: 106, 158, 224;
    --text-main: #e6ebf2;
    --text-normal: #c0cad8;
    --text-muted: #8795aa;
    --border-color: rgba(148, 170, 205, 0.12);
}

/* Light */
[data-theme="light"] {
    --bg-darker: #ffffff;
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --bg-tertiary: #eceef1;
    --primary: #2463c2;
    --primary-hover: #1d52a3;
    --accent: #2463c2;
    --accent-rgb: 36, 99, 194;
    --accent-alpha: rgba(36, 99, 194, 0.1);
    --text-main: #111827;
    --text-normal: #374151;
    --text-muted: #5f6775;
    --text-dark: #4b5563;
    --success: #1f8a4c;
    --warning: #a86d00;
    --danger: #c53030;
    --success-text: color-mix(in srgb, var(--success) 84%, #000);
    --warning-text: color-mix(in srgb, var(--warning) 82%, #000);
    --danger-text: color-mix(in srgb, var(--danger) 92%, #000);
    --premium: #a87000;
    --premium-text: color-mix(in srgb, var(--premium) 85%, #000);
    --border-color: rgba(17, 24, 39, 0.12);
    --card-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
    --nav-active-bg: rgba(36, 99, 194, 0.08);
    --focus-ring: rgba(36, 99, 194, 0.2);
    --shadow-primary: rgba(17, 24, 39, 0.12);
    --switch-off: rgba(120, 120, 128, 0.22);
    --scrollbar: rgba(17, 24, 39, 0.18);
    --shadow-dialog: 0 2px 8px rgba(17, 24, 39, 0.12);
    --shadow-float: 0 6px 16px rgba(17, 24, 39, 0.12);
    --choices-x-filter: invert(1);
    color-scheme: light;
}

[data-theme="light"] .settings-input,
[data-theme="light"] .settings-select {
    border-color: rgba(17, 24, 39, 0.18);
}

[data-theme="light"] .settings-input:focus,
[data-theme="light"] .settings-select:focus {
    border-color: var(--primary);
}

[data-theme="light"] .accordion-header {
    background-color: #f7f8fa;
}

[data-theme="light"] .accordion-header:hover {
    background-color: #eef0f3;
}

[data-theme="light"] .btn-secondary {
    border-color: rgba(17, 24, 39, 0.18);
    color: var(--text-normal);
}

[data-theme="light"] .btn-secondary:hover {
    background-color: rgba(17, 24, 39, 0.04);
    border-color: rgba(17, 24, 39, 0.3);
    color: var(--text-main);
}

[data-theme="light"] .md-toolbar {
    background: rgba(17, 24, 39, 0.03);
    border-color: rgba(17, 24, 39, 0.1);
}

[data-theme="light"] .md-toolbar button {
    background: rgba(17, 24, 39, 0.04);
    border-color: rgba(17, 24, 39, 0.1);
    color: var(--text-muted);
}

[data-theme="light"] .toast {
    background-color: #ffffff;
    color: var(--text-main);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-ui);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Top Navigation */
.top-nav {
    height: 58px;
    background-color: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
    z-index: 100;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* The Equinox logo: white on the brand purple, the picture the bot wears on Discord. It is the same in every
   theme so the brand never changes color. */
.brand-mark {
    width: 32px;
    height: 32px;
    background: url('/static/img/logo.svg?v=2') center / contain no-repeat;
    flex-shrink: 0;
    user-select: none;
}

.brand-mark-lg {
    width: 72px;
    height: 72px;
}

.logo h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

/* The trademark sign after the Equinox name: small and raised. In the header, on the sign-in screen and in the
   footer, and nowhere else on a page (docs/ui/layout-standard.md, Words). */
.brand-tm {
    margin-left: var(--space-0-5);
    font-size: max(0.55em, 9px);        /* (never under 9px: beside the footer's small print it was a 7px speck) */
    font-weight: 600;
    line-height: 0;
    vertical-align: super;
    color: var(--text-muted);
}

.logo-version {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);       /* on the chip's lighter fill the quietest tier is under the reading bar */
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: var(--pad-chip);
    border-radius: 10px;
    margin-left: var(--space-0-5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: center;
}

/* Where Equinox stands ("Alpha"): the Dashboard chip's shape, in the color for something not finished yet */
.logo-stage {
    color: var(--warning-text);
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* Server switcher (top nav): which server the dashboard is managing */
.server-switcher {
    position: relative;
}

.server-switcher[hidden],
.server-menu[hidden],
.nav-divider[hidden] {
    display: none;
}

.server-switcher-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 260px;
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.server-switcher-btn:hover,
.server-switcher-btn[aria-expanded="true"] {
    border-color: var(--primary);
}

.server-switcher-name,
.server-menu-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-switcher-caret {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.server-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    overflow: hidden;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.server-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    max-width: 320px;
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-float);
    z-index: 200;
}

.server-menu-label {
    padding: var(--space-2) var(--space-2) var(--space-1);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.server-menu-list {
    position: relative;
    max-height: 320px;
    overflow-y: auto;
}

/* Putting the servers in order (core.js serverMenuReorder): the one being dragged follows the pointer, lifted above
   the others, and a row that changes place glides there. The glide's time is also in core.js. Its pointer is the
   four arrows, which the system has of its own: the closed hand is a browser's to bring, and Opera 136 on Windows
   shows another pointer in its place. */
.server-menu-item.is-dragging {
    position: relative;
    z-index: 1;
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-float);
    cursor: move;
}

.server-menu-item.is-sliding {
    transition: transform var(--move-base) var(--ease-out);
}

.server-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-2);
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--text-main);
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.server-menu-item .server-menu-name {
    flex: 1;
}

.server-menu-item:hover,
.server-menu-item:focus-visible {
    background: var(--bg-tertiary);
    outline: none;
}

.server-menu-item .fa-check {
    color: var(--accent);
    font-size: 0.75rem;
}

.server-menu-sep {
    height: 1px;
    margin: var(--space-2) var(--space-0-5);
    background: var(--border-color);
}

.server-menu-add {
    color: var(--text-muted);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.88rem;
}

/* Layout Wrapper */
.layout-wrapper {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-darker);
    padding: var(--space-5) var(--space-3);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.category-header {
    min-height: 24px;      /* a button: 24px to press, where its margins were */
    padding: 0 var(--space-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dark);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.category-header:hover {
    color: var(--text-muted);
}

.sidebar-category {
    margin-bottom: var(--space-5);
}

.nav {
    list-style: none;
}

.top-level-nav {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.nav li {
    padding: var(--space-2) var(--space-2);
    margin-bottom: var(--space-0-5);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.nav li:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-normal);
}

.nav li.active {
    background-color: var(--nav-active-bg);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav li i {
    width: 18px;
    font-size: 0.9rem;
    text-align: center;
    flex-shrink: 0;
}

.nav li.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav li.disabled:hover {
    background-color: transparent;
    color: var(--text-muted);
}

/* Each page's header: its title (the menu's name for it), what the page is for, and the page's
   own actions beside Refresh, which showTab() moves into the header on screen */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-5);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.page-heading {
    flex: 1 1 auto;
    min-width: 0;
}

/* (the leading a card's description has, so a line that wraps isn't tighter here than there, and no last
   line of one word where the browser can help it) */
.page-heading p {
    max-width: var(--measure);
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
    text-wrap: pretty;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: var(--space-2);
    align-items: center;
}

.section-title h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--space-1);
    letter-spacing: -0.01em;
}

.section-title p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Tabs. Text on a page is 0.9rem unless a part sets its own size, so nothing falls back to the browser's 16px */
.tab-content {
    display: none;
    font-size: 0.9rem;
}

/* Running text keeps to the measure. A paragraph that is centered in its box is centered at that width too. */
.tab-content :is(p, small.text-muted) {
    max-width: var(--measure);
}

.tab-content :is(.text-center, .apps-none, .empty-state, .table-empty) :is(p, small.text-muted),
.tab-content p:is(.text-center, .empty-state-line) {
    margin-inline: auto;
}

.hidden {
    display: none !important;
}

/* ══ Motion ═════════════════════════════════════════════════════════════════════════════════════════════════════
   One way of moving for the whole dashboard (docs/ui/layout-standard.md, "Motion"). Times, distances and curves
   are the tokens in tokens.css; tests/test_ui_standards.py refuses a time written out in a transition.
     --motion-*   a color or an opacity changing: fast for what answers the pointer, base for what appears or
                  goes, slow for a dialog
     --move-*     the same for whatever travels, turns, grows or shrinks. Less motion makes these nothing: the
                  thing is simply there, and still fades
   Preferences > Animation: "Reduced" stops all of it. The device's own reduce-motion setting stops what moves
   and every running animation, and leaves the fades. */

/* Whatever answers the pointer or the keyboard changes color over one short time. :where() gives the rule no
   weight, so a part that also moves writes its own transition and lists all it needs. */
:where(a, button, input, select, textarea, summary, label, [role="button"], [role="tab"], [tabindex="0"], li[data-tab], tr) {
    transition: color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out),
                border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out),
                opacity var(--motion-fast) var(--ease-out), filter var(--motion-fast) var(--ease-out);
}

/* A press is answered at once; letting go eases back */
:where(a, button, summary, [role="button"], [role="tab"]):active {
    transition-duration: 0s;
}

/* Whatever the keyboard lands on shows the same ring, at once, unless a part draws its own (a field's is its
   border): without this each browser drew its own on every button that had none */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* A box may glide to the height of what is in it, where the browser can do that (elsewhere it opens at once) */
:root {
    interpolate-size: allow-keywords;
}

/* ── Folds: what opens under its row (a feature's settings, a check's finding, a role's pages, a ticket type, a
   part of an embed). It grows to its height as it fades in, and goes the same way. While it moves it is clipped;
   open, it is not, so a menu inside can hang past its edge. Closing needs nothing from the scripts: `hidden` or
   the class is enough. Opening glides when someone opened it. A fold that is drawn already open (a list drawn
   again after a save) is simply there, which is what .is-touched on its row says (common.js). */
:is(.mod-row-panel, .perm-role-body, .tp-type > .module-body, .accordion-content) {
    transition: height var(--move-base) var(--ease-out), padding var(--move-base) var(--ease-out),
                opacity var(--motion-base) var(--ease-out), overflow 0s var(--move-base) allow-discrete,
                display var(--move-base) allow-discrete;
}

:is(.mod-row-panel, .perm-role-body, .tp-type > .module-body)[hidden],
.accordion-item:not(.is-open) > .accordion-content {
    height: 0;
    padding-block: 0;
    opacity: 0;
    overflow: clip;
    transition-delay: 0s;       /* (clipped from the first moment of closing) */
}

@starting-style {
    .is-touched > :is(.mod-row-panel, .perm-role-body, .module-body):not([hidden]),
    .accordion-item.is-open > .accordion-content {
        height: 0;
        padding-block: 0;
        opacity: 0;
        overflow: clip;
    }
}

/* A <details> does the same with what is in it (not the export menu's: that one is a menu hanging from its
   button, and a menu must not be clipped while it comes in) */
details:not(.apps-export)::details-content {
    height: 0;
    overflow: clip;
    transition: height var(--move-base) var(--ease-out), content-visibility var(--move-base) allow-discrete;
}

details[open]:not(.apps-export)::details-content {
    height: auto;
    overflow: visible;
    transition: height var(--move-base) var(--ease-out), overflow 0s var(--move-base) allow-discrete,
                content-visibility var(--move-base) allow-discrete;
}

/* ── Menus: what drops from a button. It fades in a short way from where it hangs, and fades out. ── */
:is(.account-menu, .server-menu, .emoji-picker) {
    transition: opacity var(--motion-fast) var(--ease-out), translate var(--move-fast) var(--ease-out),
                display var(--motion-fast) allow-discrete;
}

:is(.account-menu, .server-menu)[hidden],
.emoji-picker:not(.active) {
    opacity: 0;
    translate: 0 calc(var(--move-near) * -1);
    pointer-events: none;
}

@starting-style {
    :is(.account-menu, .server-menu):not([hidden]),
    .emoji-picker.active,
    .apps-export[open] .apps-export-menu,
    .is-active:is(.choices__list--dropdown, .choices__list[aria-expanded]) {
        opacity: 0;
        translate: 0 calc(var(--move-near) * -1);
    }
}

/* (a list of choices and an export menu only come in: the card around one stops making room for it the moment
   it closes, and a fade would be cut off at the card's edge) */
.apps-export-menu,
.is-active:is(.choices__list--dropdown, .choices__list[aria-expanded]) {
    transition: opacity var(--motion-fast) var(--ease-out), translate var(--move-fast) var(--ease-out);
}

/* ── Dialogs: the page dims while the dialog comes up a short way. Both go by fading, quicker (common.js
   closeOverlay puts .is-leaving on it and takes it away after). A question that follows a yes is simply there:
   the page stays dimmed and only the words change (.is-following). ── */
.modal-overlay {
    transition: opacity var(--motion-base) var(--ease-out);
}

.modal-overlay > .modal-content {
    transition: translate var(--move-slow) var(--ease-out);
}

@starting-style {
    .modal-overlay {
        opacity: 0;
    }

    .modal-overlay > .modal-content {
        translate: 0 var(--move-far);
    }
}

.modal-overlay.is-leaving {
    opacity: 0;
    pointer-events: none;
    transition-duration: var(--motion-fast);
}

.modal-overlay.is-following,
.modal-overlay.is-following > .modal-content {
    transition: none;
}

@starting-style {
    .tab-content.active {
        opacity: 0;
    }
}

/* ...its header at once, and the rest once the page's data is in (core.js loadTab): it fades in whole instead
   of showing "Loading..." and moving as it fills. :where() keeps a part's own transition first. A theme whose
   cards appear one by one does its own. */
:where(.tab-content) > * {
    transition: opacity var(--motion-base) var(--ease-out);
}

html:not([data-card-in]) .tab-content.is-loading > :not(.page-header) {
    opacity: 0;
}

/* A tab's part comes in the same way when its tab is chosen */
[role="tabpanel"] {
    transition: opacity var(--motion-base) var(--ease-out);
}

@starting-style {
    [role="tabpanel"]:not([hidden]) {
        opacity: 0;
    }
}

/* Headline numbers: a label over its number, side by side in a row that wraps. The same in both views;
   the Everything view only adds numbers (class "extra"). */
.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-8);
    margin: 0;
}

.stat-row dt {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* "Skip to the page" (index.html): out of sight until Tab reaches it, then over the top bar's corner */
.skip-link {
    position: fixed;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 1000;
    padding: var(--pad-control);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    font: inherit;
    font-weight: 600;
    transform: translateY(-200%);
}

.skip-link:focus-visible {
    transform: none;
}

/* While the sign-in screen (or the one saying there is no access) covers everything, what lies under it is out of
   reach as well as out of sight: Tab went to the skip button under it and on through a menu nobody could see */
body:has(> .gate:not([hidden])) > :is(.skip-link, .top-nav, .layout-wrapper) {
    visibility: hidden;
}

/* A figure nobody has yet ("--", setText and statTile mark it) keeps its dashes together: with figures of one width
   each dash took a digit's room and the two stood apart ("- -") */
.is-unknown {
    font-variant-numeric: normal !important;     /* (a utility, like .text-end: it outranks the rows and
                                                    tables that set figures of one width) */
}

.stat-row dd {
    margin: var(--space-1) 0 0;
    color: var(--text-main);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

/* A number said in words ("Support", "4.6 of 5") is set smaller than a figure */
.stat-row dd.is-text {
    font-size: 1rem;
    line-height: 1.62;
}

.stat-row dd small {
    display: block;
    margin-top: var(--space-0-5);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.stat-row dt i {
    margin-right: var(--space-1);
}

/* Threat Detection: what happened lately, under the level it explains; and how many members are at each level, above
   the risk queue's filters */
.sec-threat {
    container-type: inline-size;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-4) var(--space-5);
}

.sec-threat > #sec-threat-now {
    flex: 1 1 0;
    min-width: 0;
}

.sec-threat .stat-row {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: var(--space-3) var(--space-6);
    padding-left: var(--space-5);
    border-left: 1px solid var(--border-color);
}

/* A narrow card (a small window, or the menu taking room on the left): the figures go under the level */
@container (max-width: 560px) {
    .sec-threat > #sec-threat-now {
        flex-basis: 100%;
    }

    .sec-threat .stat-row {
        flex-basis: 100%;
        justify-content: start;
        padding: var(--space-4) 0 0;
        border-left: 0;
        border-top: 1px solid var(--border-color);
    }
}

/* A row of figures at the top of a card, above its filters, table or list (the risk queue, Suggestions, an
   incident drill's history): it has the card's side padding, and the body under it keeps its own */
.settings-card > .stat-row {
    padding: var(--space-4) var(--pad-card-x) 0;
}

.sec-figure-critical dt i { color: var(--status-critical); }
.sec-figure-high dt i { color: var(--status-serious); }
.sec-figure-elevated dt i { color: var(--status-warning); }
.sec-figure-watch dt i { color: var(--text-muted); }

.stat-row:empty {
    display: none;
}

/* Inside a card, the numbers that sum up the chart under them */
.settings-card-body > .stat-row:not(:last-child) {
    margin-bottom: var(--space-field);
}

/* On a phone the numbers line up in two columns */
@media (max-width: 640px) {
    .stat-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-4);
    }

    .stat-row dt {
        white-space: normal;
    }
}

/* ── Bot Info Rows ── */

.info-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ── Feature Cards ── */

/* Settings Cards */
.settings-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

/* Prevent double-spacing: gap handles all space between cards inside a container */
.settings-container > .settings-card {
    margin-bottom: 0;
    margin-top: 0;
}

.settings-card {
    background-color: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: visible;
    box-shadow: var(--card-shadow);
}

.settings-card-header {
    display: flex;
    flex-wrap: wrap;            /* controls beside the title go under it when both don't fit (a phone) */
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

/* (the title's own block gives way first, so on a wide screen nothing wraps that didn't before) */
.settings-card-header > div:first-child {
    flex: 1 1 12rem;
    min-width: 0;
}

/* On a phone the title's block has the line to itself and the controls go under it (a button beside it left the
   description a column half the card wide). A switch is small and stays beside the title: under the description
   it stood alone on a line of its own. */
@media (max-width: 640px) {
    .settings-card-header:not(:has(> :is(.switch, .toggle-switch))) > div:first-child {
        flex-basis: 100%;
    }
}


.settings-card-header h3 {
    font-size: 0.98rem;
    font-weight: 700;
    margin-bottom: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
}

.settings-card-header p {
    color: var(--text-muted);
    font-size: 0.83rem;
    line-height: 1.45;
}

.settings-card-header>i {
    color: var(--text-muted);
    cursor: pointer;
    margin-top: var(--space-1);
}

.settings-card-body {
    overflow: visible;
}

.settings-input,
.settings-select {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 6px;
    padding: var(--pad-control);
    font-size: 0.9rem;
    line-height: 1.5;
    width: 100%;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

/* One line of text: the shared control height (a box of several lines keeps its padding) */
input.settings-input:not([type="file"]),
select.settings-select:not([multiple]):not([size]) {
    height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
}

/* One line of text that can run long (an application's question): a box as tall as the others while it is one
   line, and as tall as its text after that, so all of it shows. Where the browser can't size a box by what is
   in it, it stays one line that the cursor moves along, as the field it stands in for did. */
textarea.settings-input.is-growing {
    field-sizing: content;
    min-height: var(--control-height);
    padding-block: calc(var(--space-2) - 1px);
    line-height: 1.4;
    overflow: hidden;
    resize: none;
}

.settings-input:focus,
.settings-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Browser-drawn controls. Scrollbars are thin and take the theme's colors; a
   list's chosen rows use the accent instead of the browser's own blue or gray. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
}

select option,
select optgroup {
    background-color: var(--bg-card);
    color: var(--text-normal);
}

select[multiple] {
    padding: var(--space-1);
}

select[multiple] option {
    padding: var(--space-2) var(--space-2);
    border-radius: 5px;
}

/* A plain background-color is ignored on chosen options; a gradient is not */
select[multiple] option:checked {
    background: linear-gradient(0deg, color-mix(in srgb, var(--primary) 22%, transparent),
                                      color-mix(in srgb, var(--primary) 22%, transparent));
    color: var(--text-main);
}

select[multiple]:focus option:checked {
    background: linear-gradient(0deg, var(--primary), var(--primary));
    color: #ffffff;
}

/* Discohook Embed Builder Layout */
.embed-builder-layout {
    display: grid;
    grid-template-columns: minmax(350px, 1fr) 1fr;
    align-items: start;
    scroll-margin-top: var(--space-4);      /* (Edit on a posted message brings the form to the top, a gap under the edge) */
}

.embed-editor-col {
    display: flex;
    flex-direction: column;
}

/* A narrow screen: the preview first, then the editor under it */
@media (max-width: 900px) {
    .embed-builder-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .embed-builder-layout > .embed-preview-col {
        position: static;
        order: -1;
    }
}

/* Accordions */
.accordion-item {
    background-color: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* The item lets pickers overflow it, so the header rounds its own corners to match (the bottom ones only
   while the section is closed) */
.accordion-header {
    border-radius: inherit;
}

.accordion-item.is-open > .accordion-header {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.accordion-item.is-open .toggle-icon {
    transform: rotate(180deg);
}

.accordion-header {
    padding: var(--space-4) var(--space-4);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border: 0;
    background-color: var(--bg-darker);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
    color: var(--text-normal);
}

.accordion-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.accordion-header:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.02);
}

.accordion-header i {
    font-size: 1rem;
    margin-right: var(--space-2);
}

.accordion-header span {
    display: flex;
    align-items: center;
}

/* The icon before a section's name gets the room of the widest one, so the names under each other start level */
.accordion-header span > i {
    flex: none;
    width: 1.25em;
    text-align: center;
}

/* (open while its item is: core.js toggleAccordion; how it opens is under "Motion") */
.accordion-content {
    padding: var(--space-4);
    display: none;
    border-top: 1px solid var(--border-color);
}

.accordion-item.is-open > .accordion-content {
    display: block;
}

/* Chart Range Selector */
.chart-ranges {
    display: flex;
    flex-wrap: wrap;            /* (four ranges in a longer language take two rows on a phone) */
    flex: 0 0 auto;
    max-width: 100%;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: var(--space-0-5);
    gap: var(--space-0-5);
}

.chart-ranges button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    min-height: 24px;
    padding: 0 var(--space-2);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.chart-ranges button:hover {
    color: var(--text-main);
}

.chart-ranges button.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Under the Embeds page's sections: the message's color, then its Send button (the palette itself is the
   shared one, further down) */
.embed-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    align-items: stretch;
}

.w-full {
    width: 100% !important;
    display: block;
}

/* Spacing utility, named after the spacing scale (.mt-N is var(--space-N)), for the one-off; the layout classes
   (.stack, .field-grid, card and page gaps) space everything else. Add a step only with a user. */
.mt-2 { margin-top: var(--space-2); }

/* Form group: consistent label + input spacing */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-group>label,
.accordion-content>label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: var(--space-label);
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Override for labels with nested spans (sub-text descriptors) — keep normal case */
.form-group>label span,
.accordion-content>label span {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 0.8rem;
}

.form-group input[type="text"],
.form-group textarea,
.accordion-content input[type="text"],
.accordion-content textarea {
    width: 100%;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: var(--pad-control);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.accordion-content input[type="text"]:focus,
.accordion-content textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Live Discord Preview */
.embed-preview-col {
    position: sticky;
    top: var(--space-4);
}

.discord-message-container {
    font-size: 1rem;
    background-color: #313338;
    color: #dbdee1;
    padding: var(--space-4);
    border-radius: 8px;
    display: flex;
    gap: var(--space-4);
    max-width: 600px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.discord-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.discord-message-content {
    flex: 1;
    min-width: 0;
}

.discord-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.discord-username {
    font-size: 1rem;
    font-weight: 500;
    color: white;
}

.discord-bot-tag {
    background-color: var(--primary);
    color: var(--on-primary);
    font-size: 0.7rem;
    padding: var(--space-0-5) var(--space-1);
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;        /* (in a narrow preview the tag broke into its mark and its word) */
}

.discord-timestamp {
    font-size: 0.75rem;
    color: #a0a6af;
}

.discord-text {
    color: #dcddde;
    font-size: 1rem;
    margin-bottom: var(--space-2);
    word-break: break-word;
    white-space: pre-wrap;
}

.discord-embed {
    background-color: #2b2d31;
    border-left: 4px solid #5865F2;
    /* dynamic via js */
    border-radius: 4px;
    padding: var(--space-2) var(--space-4) var(--space-4) var(--space-4);
    margin-top: var(--space-1);
    display: inline-block;
    max-width: 100%;
    min-width: min(250px, 100%);
    box-sizing: border-box;
}

.discord-embed-content-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
}

/* The text beside the small picture */
.discord-embed-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

/* The dropdown or the buttons under a ticket panel's preview (tickets.js) */
.discord-components {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    width: 400px;
    max-width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid #3f4147;
    border-radius: 4px;
    background: #1e1f22;
    color: #dbdee1;
    font-size: 0.9rem;
}

.discord-components.is-plain {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
}

.discord-embed-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.discord-author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.discord-author-name {
    color: #f2f3f5;
    font-weight: 600;
    font-size: 0.875rem;
}

.discord-embed-title {
    font-weight: 600;
    font-size: 1rem;
    color: #00A8FC;
}

/* An embed's fields (a free game's Worth and Platforms, a stream's Playing): side by side, as Discord puts
   short ones */
.discord-embed-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: var(--space-2) var(--space-4);
    color: #dcddde;
    font-size: 0.875rem;
}

.discord-embed-field-name {
    font-weight: 600;
    color: #f2f3f5;
}

/* A post's preview under the settings that make it (Feeds): a line of its own in a row's or a section's grid, as
   wide as Discord shows a message */
.mod-preview {
    grid-column: 1 / -1;
    max-width: 34rem;
    margin-top: var(--space-3);
}

.discord-embed-desc {
    color: #dcddde;
    font-size: 0.875rem;
    white-space: pre-wrap;
    line-height: 1.375;
}

.discord-embed-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 4px;
    object-fit: contain;
    margin-top: var(--space-2);
}

.discord-embed-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.discord-embed-footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.discord-footer-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.discord-footer-text {
    color: #a0a6af;
    font-size: 0.75rem;
}

/* What hangs under the message: a panel's dropdown or buttons, a welcome message's picture card */
.discord-under {
    margin-top: var(--space-2);
}

/* In place of a message that holds nothing yet (the footer's gray: 5.2 to 1 on the box) */
.discord-empty {
    margin: 0;
    color: #a0a6af;
    font-style: italic;
}

/* A button under the message, in Discord's four colors. Its gray is Discord's own and not the dashboard's card
   color, which was white under white words in the light look. */
.discord-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    padding: var(--space-0-5) var(--space-4);
    height: 32px;
    min-width: 60px;
    border-radius: 3px;
    user-select: none;
    font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.discord-btn-primary {
    background-color: #5865F2;
}

.discord-btn-secondary {
    background-color: #4e5058;
}

.discord-btn-success {
    background-color: #248046;
}

.discord-btn-danger {
    background-color: #da373c;
}

/* Buttons */
.btn {
    padding: var(--pad-control);
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap-icon);
    min-height: var(--control-height);
    font-family: inherit;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.btn-sm {
    min-height: 24px;
    padding: var(--pad-control-sm);
    font-size: 0.8rem;
    gap: var(--gap-icon);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
    font-weight: 700;
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background-color: rgba(237, 66, 69, 0.08);
    color: var(--danger-text);
    border-color: rgba(237, 66, 69, 0.2);
}

.btn-danger:hover {
    background-color: rgba(237, 66, 69, 0.18);
    border-color: rgba(237, 66, 69, 0.4);
}

/* Pressed: a shade further than under the pointer, and at once ("Motion"). A button never lifts, glows or moves. */
.btn-primary:active:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-hover) 86%, #000);
    border-color: color-mix(in srgb, var(--primary-hover) 86%, #000);
}

.btn-secondary:active:not(:disabled) {
    background-color: color-mix(in srgb, var(--text-main) 10%, transparent);
}

.btn-danger:active:not(:disabled) {
    background-color: rgba(237, 66, 69, 0.28);
}


.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loader */
.loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin: var(--space-12) auto;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.choices__list--multiple .choices__item.is-disabled .choices__button {
    display: none !important;
}

.choices__list--multiple .choices__item.is-disabled {
    opacity: 0.75 !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-muted) !important;
    padding-right: var(--space-3) !important;
    cursor: not-allowed !important;
}

/* A checkbox with its words beside it */
.check-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Settings history: what changed, a line each */
.history-line {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: 0.85rem;
}

.history-what {
    color: var(--text-normal);
}

/* A server's first day on Analytics: one notice instead of a long page of empty charts (dashboard.js) */
.first-day-notice {
    display: none;
}

#analytics-tab.is-first-day .first-day-notice {
    display: block;
}

#analytics-tab.is-first-day > :not(.page-header, .no-server-notice, .first-day-notice) {
    display: none;
}

.first-day-notice p {
    margin-top: var(--space-1);
}

/* "Finish setting up" under the Overview's "nothing to report yet" */
#dash-proof > .btn {
    display: flex;
    margin: var(--space-1) auto var(--space-3);
}

/* How a figure went against the week before, beside it */
.stat-compare {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Links to a long page's sections: on a phone only */
.page-jump {
    display: none;
}

@media (max-width: 640px) {
    .page-jump {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        margin-bottom: var(--space-4);
    }
}

/* While Equinox can't be reached (common.js): one line across the top, over the header */
.connection-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4000;
    padding: var(--space-2) var(--space-4);
    padding-top: max(var(--space-2), env(safe-area-inset-top));
    background-color: color-mix(in srgb, var(--warning) 22%, var(--bg-card));
    border-bottom: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border-color));
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
}

/* Toast: a short notice. Solid, so nothing behind it shows through its text; core.js sets
   --toast-top / --toast-bottom to keep it clear of the header and the menu wherever that sits. */
.toast {
    position: fixed;
    bottom: calc(var(--toast-bottom, 0px) + var(--space-6));
    right: var(--space-6);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: var(--space-3) var(--space-5);
    border-radius: 8px;
    box-shadow: var(--shadow-float);
    translate: 0 var(--move-far);
    opacity: 0;
    transition: opacity var(--motion-base) var(--ease-out), translate var(--move-base) var(--ease-out);
    z-index: 4000;      /* above dialogs, so a dialog's own messages show */
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 0.88rem;
    min-width: 220px;
    pointer-events: none;
}

.toast.show {
    translate: none;
    opacity: 1;
}

/* The message in the normal text color; the icon and edge say how it went */
.toast > i {
    color: var(--success-text);
}

.toast.error {
    border-color: color-mix(in srgb, var(--danger) 55%, var(--border-color));
    background-color: color-mix(in srgb, var(--danger) 10%, var(--bg-card));
}

.toast.error > i {
    color: var(--danger-text);
}

.toast.success {
    border-color: color-mix(in srgb, var(--success) 55%, var(--border-color));
    background-color: color-mix(in srgb, var(--success) 10%, var(--bg-card));
}

/* ========== MARKDOWN TOOLBAR ========== */
.md-toolbar {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: var(--space-2) var(--space-2);
}

.md-toolbar button {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-normal);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: var(--space-8);          /* one letter is still a 24px target and more */
    padding: var(--space-1) var(--space-2);
    line-height: 1.4;
}

.md-toolbar button:hover {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

.md-toolbar .md-sep {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: var(--space-0-5) var(--space-1);
}

.md-textarea-wrap textarea {
    border-radius: 0 0 6px 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ========== TOGGLE SWITCH ==========
   iPhone-style: the knob glides across on a spring-like curve, stretches while
   pressed, and the track fills with green. Three sizes share the same parts:
   .toggle-switch (default), .toggle-switch-sm, and the older .switch/.slider. */
.toggle-switch,
.toggle-switch-sm,
.switch {
    --sw-w: 50px;
    --sw-h: 30px;
    --sw-pad: 2px;
    --sw-knob: calc(var(--sw-h) - var(--sw-pad) * 2);
    --sw-stretch: 6px;
    position: relative;
    display: inline-block;
    width: var(--sw-w);
    height: var(--sw-h);
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.toggle-switch-sm {
    --sw-w: 36px;
    --sw-h: 22px;
    --sw-stretch: 4px;
}

.switch {
    --sw-w: 46px;
    --sw-h: 28px;
    margin-top: var(--space-2);
}

.toggle-switch input,
.toggle-switch-sm input,
.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider,
.toggle-slider-sm,
.slider {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 999px;
    background-color: var(--switch-off);
    cursor: pointer;
    transition: background-color var(--motion-base) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.toggle-slider::before,
.toggle-slider-sm::before,
.slider::before {
    content: '';
    position: absolute;
    top: var(--sw-pad);
    bottom: auto;
    left: var(--sw-pad);
    width: var(--sw-knob);
    height: var(--sw-knob);
    border-radius: 999px;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28), 0 0 1px rgba(0, 0, 0, 0.2);
    transform: none;
    /* (the knob slides on the times the device's reduce-motion setting leaves alone, as a switch does on a
       phone: the movement is small and shows what changed. Animation: Reduced still stops it.) */
    transition: left var(--motion-base) var(--ease-spring), width var(--motion-fast) var(--ease-out);
}

.toggle-switch input:checked + .toggle-slider,
.toggle-switch-sm input:checked + .toggle-slider-sm,
.switch input:checked + .slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before,
.toggle-switch-sm input:checked + .toggle-slider-sm::before,
.switch input:checked + .slider::before {
    left: calc(100% - var(--sw-knob) - var(--sw-pad));
    transform: none;
}

/* Pressing stretches the knob toward the side it is heading */
.toggle-switch:active .toggle-slider::before,
.toggle-switch-sm:active .toggle-slider-sm::before,
.switch:active .slider::before {
    width: calc(var(--sw-knob) + var(--sw-stretch));
}

.toggle-switch:active input:checked + .toggle-slider::before,
.toggle-switch-sm:active input:checked + .toggle-slider-sm::before,
.switch:active input:checked + .slider::before {
    left: calc(100% - var(--sw-knob) - var(--sw-stretch) - var(--sw-pad));
}

.toggle-switch input:focus-visible + .toggle-slider,
.toggle-switch-sm input:focus-visible + .toggle-slider-sm,
.switch input:focus-visible + .slider {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.toggle-switch input:disabled + .toggle-slider,
.toggle-switch-sm input:disabled + .toggle-slider-sm,
.switch input:disabled + .slider {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ========== COLOR PICKER (shared component) ========== */
.cp-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-top: var(--space-2);
}

.cp-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    box-sizing: border-box;
    /* a hairline, so white shows on a light theme and black on a dark one (from the text color: the border
       color's 7% left the black swatch all but invisible on a dark card) */
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-main) 20%, transparent);
    transition: border-color var(--motion-fast) var(--ease-out), transform var(--move-fast) var(--ease-out);
    flex-shrink: 0;
}

.cp-swatch:hover {
    transform: scale(1.15);
}

/* The picked color: a ring outside it in the accent color, which shows on every color (a white border on the
   white swatch, or on a light theme, showed nothing) */
.cp-swatch.active {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reached by keyboard: the same ring in the text color, so it is told apart from the picked one */
.cp-swatch:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.cp-custom {
    display: flex;
    flex-wrap: wrap;            /* ("Benutzerdefiniert" leaves no room for the code on a phone) */
    align-items: center;
    gap: var(--space-2);
    margin-left: var(--space-0-5);
}

/* The picker for any other color (its edge is from the text color, as a swatch's hairline is: a white edge
   showed nothing in the light look) */
.cp-custom input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 36px;
    height: 28px;
    padding: 0;
    border: 2px solid color-mix(in srgb, var(--text-main) 20%, transparent);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out),
        transform var(--move-fast) var(--ease-out);
}

.cp-custom input[type="color"]::-webkit-color-swatch {
    border-radius: 6px;
    border: none;
}

.cp-custom input[type="color"]::-moz-color-swatch {
    border-radius: 6px;
    border: none;
}

.cp-custom input[type="color"]:hover {
    border-color: color-mix(in srgb, var(--text-main) 45%, transparent);
}

/* Holding the color, when it is none of the nine */
.cp-custom input[type="color"].active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
    transform: scale(1.15);
}

.cp-custom input[type="color"]:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.cp-custom span {
    order: -1;          /* its word comes before the box and its code, as a label does, not trailing after them */
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* The code box in a palette row is as tall as the swatches and the picker beside it (a box of the control height
   stood 4px above and below them, the one thing in the row of another size) */
.cp-row input[type="text"].color-code {
    height: calc(var(--control-height) - var(--space-2));
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* --- EMOJI FIELDS AND THE PICKER (emoji.js): one popover for every emoji setting --- */
.emoji-field {
    display: flex;
    align-items: center;
    gap: var(--gap-row);
}

.emoji-field .emoji-input {
    flex: 1 1 auto;
    min-width: 0;
}

.emoji-field .emoji-pick-btn {
    flex: 0 0 auto;
}

.ep-btn img {
    width: 24px;
    height: 24px;
}

.emoji-picker {
    display: none;
    position: fixed;
    z-index: 10001;
    flex-direction: column;
    width: 336px;
    max-width: calc(100vw - var(--space-4));
    max-height: 400px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.emoji-picker.active {
    display: flex;
}

.emoji-picker-head {
    flex: 0 0 auto;
    padding: var(--space-2);
    border-bottom: 1px solid var(--border-color);
}

/* The nine groups and the server's own fit in one row; the grid takes the rest and scrolls */
.emoji-picker-tabs {
    flex: 0 0 auto;
    display: flex;
    gap: var(--space-0-5);
    padding: var(--space-1) var(--space-2);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.emoji-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.emoji-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.emoji-tab.is-active {
    background: var(--accent-alpha);
    border-color: var(--accent);
    color: var(--text-main);
}

.emoji-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--space-0-5);
    padding: var(--space-2);
    overflow-y: auto;
    align-content: start;
}

.ep-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.ep-btn:hover,
.ep-btn:focus-visible {
    background: var(--bg-tertiary);
}

.emoji-picker-note {
    grid-column: 1 / -1;
    margin: 0;
    padding: var(--space-2);
    font-size: 0.85rem;
}

/* Analytics: the server's emoji by use */
.an-emoji-name {
    display: inline-flex;
    align-items: center;
    gap: var(--gap-icon);
}

.emoji-unused {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-hint);
}

.emoji-unused img {
    width: 28px;
    height: 28px;
}

/* --- SERVER MAP (server-map.js): the channel tree on the left, details and forms on the right --- */
.smap-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: var(--space-page);
    align-items: start;
}

/* The details stay beside the channel list while it scrolls, so a channel at the bottom of a long list
   doesn't mean scrolling back up to read it; long details scroll on their own (they hold no pickers that
   would be cut off, which is why cards don't usually scroll). Short enough to fit above the room every page
   keeps at its end, so at the bottom of the list they still show whole. */
.smap-detail-card {
    position: sticky;
    top: var(--space-4);
    display: flex;
    flex-direction: column;
    max-height: calc(var(--view-h, 100vh) - var(--space-8) - var(--room-page-end) - var(--space-12));
    min-height: 0;
}

/* (named as a card too, so this outranks the rule further down that keeps card bodies from clipping dropdowns:
   with the same weight that one won, and long details ran out of the card's frame) */
.settings-card.smap-detail-card > .settings-card-body {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border-radius: 0 0 9px 9px;         /* the card's corners, inside its border: the shade at its edge stays in them */
}

/* A form's buttons stay at the panel's foot while the form scrolls under them: in a short window Create and
   Cancel under a new channel's form sat cut in half at the card's edge (the panel stays pinned beside the list,
   so a channel low in a long list is read without scrolling back up to it) */
.smap-detail-card .smap-form > .cell-actions {
    position: sticky;
    bottom: calc(-1 * var(--pad-card-y));
    margin: 0 calc(-1 * var(--pad-card-x)) calc(-1 * var(--pad-card-y));
    padding: var(--space-3) var(--pad-card-x) var(--pad-card-y);
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

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

    .smap-detail-card {
        position: static;
        max-height: none;
    }
}

.smap-tree {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    font-size: 1rem;
}

.smap-cat {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-3);
    padding: var(--space-0-5) var(--space-2) var(--space-0-5) var(--space-1);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.smap-cat:first-child {
    margin-top: 0;
}

.smap-cat-name {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.smap-cat-name:disabled {
    cursor: default;
}

.smap-cat-name:hover:not(:disabled) {
    color: var(--text-main);
}

/* A selected category looks like a selected channel */
.smap-cat.is-selected {
    background: var(--accent-alpha);
    border-color: var(--accent);
    color: var(--text-main);
}

/* The arrow that folds a category's channels away (a blank of the same width on "No category") */
.smap-cat-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: inherit;
    cursor: pointer;
}

span.smap-cat-toggle {
    cursor: default;
}

button.smap-cat-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.smap-cat-toggle i {
    font-size: 0.7rem;
    transition: transform var(--move-fast) var(--ease-out);
}

.smap-cat.is-folded .smap-cat-toggle i {
    transform: rotate(-90deg);
}

/* Dragging in the tree, like Discord: the row being moved fades, a line shows where it lands, and a
   category it would go into lights up. Long presses on phones start a drag, so no text selection */
.smap-tree {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.smap-dragging .smap-chan,
.smap-dragging .smap-cat-name {
    cursor: move;
}

.smap-chan.is-dragged,
.smap-cat.is-dragged {
    opacity: 0.4;
}

.smap-drop-before {
    box-shadow: inset 0 2px 0 var(--accent);
}

.smap-drop-after {
    box-shadow: inset 0 -2px 0 var(--accent);
}

.smap-drop-into {
    background: var(--accent-alpha);
    border-radius: 6px;
}

/* "No category": a place to drop a channel, shown at the end of the tree while dragging one when no
   channel is outside a category */
.smap-drop-only {
    display: none;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
}

.smap-dragging-channel .smap-drop-only {
    display: flex;
}

.smap-chan {
    display: flex;
    align-items: center;
    gap: var(--gap-icon);
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-normal);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.smap-chan:hover {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.smap-chan.is-selected {
    background: var(--accent-alpha);
    border-color: var(--accent);
    color: var(--text-main);
}

/* (the room of the widest icon: the forum and voice ones are wider than "#", and in a narrower box they ran
   into the name) */
.smap-chan > i,
.smap-detail-head > i {
    flex: none;
    width: 1.25em;
    color: var(--text-muted);
    text-align: center;
}

.smap-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smap-badges {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.smap-badges .is-warning,
.smap-list .is-warning {
    color: var(--status-warning);
}

.smap-tag {
    padding: var(--pad-chip);
    border-radius: 4px;
    background: var(--bg-tertiary);
    font-weight: 700;
}

.smap-count {
    color: var(--text-dark);
}

/* The page's own gap sets these apart from the cards; with nothing to say their box takes no room, so the
   cards start one gap under the header as on every other page */
#smap-notes:empty {
    display: none;
}

.smap-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.smap-note {
    display: flex;
    align-items: flex-start;
    gap: var(--gap-icon);
    padding: var(--pad-tile);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.smap-note.is-warning {
    border-color: var(--status-warning);
}

.smap-note i {
    color: var(--status-warning);
}

.smap-note .btn-link {
    font-weight: 600;
}

.smap-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-icon);
    margin-bottom: var(--space-inner);
}

.smap-detail-head h4 {
    margin: 0;
    font-size: 1.05rem;
}

/* (and a backup's details, Backups page) */
.smap-facts,
.bk-details {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    margin: 0;
}

.smap-facts dt {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.smap-facts dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* A Discord ID reads like the values around it; one click selects the whole of it, ready to copy */
.smap-id {
    -webkit-user-select: all;
    user-select: all;
}

.smap-list {
    margin: 0;
    padding-left: var(--space-4);
}

.smap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.smap-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pad-chip);
    border-radius: 999px;
    background: var(--bg-tertiary);
    font-size: 0.8rem;
}

.smap-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.smap-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-inner);
}

.smap-chip.is-warning {
    color: var(--status-warning);
}

.smap-detail-head + .smap-chips {
    margin-bottom: var(--space-inner);
}

.smap-form {
    display: grid;
    gap: var(--space-field);
    margin-top: var(--space-page);
    padding-top: var(--space-page);
    border-top: 1px solid var(--border-color);
}

/* A form shown on its own (a new channel, an action) starts the card, with no divider above it */
.smap-form:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.smap-form-title {
    margin: 0;
    font-size: 0.95rem;
}

.smap-danger .smap-form-title {
    color: var(--danger-text);
}

/* The details' tabs (Overview, History, Settings), and what each shows */
.smap-tabs {
    margin-top: var(--space-inner);
}

.smap-panel {
    margin-top: var(--space-inner);
}

.smap-settings,
.smap-history,
.smap-threads {
    display: grid;
    gap: var(--space-field);
}

/* (Open or Archived: as wide as its two words, not the panel) */
.smap-threads > .segmented {
    justify-self: start;
}

/* A channel's threads: a title with its tags, what is known of it, and who can see it */
.smap-thread-list {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.smap-thread {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
    overflow-wrap: anywhere;
}

.smap-thread-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

/* Buttons side by side ("Delete category", "Delete category and channels") go onto a second line when the panel
   is narrow, instead of pushing it wider than its card */
.smap-form .cell-actions {
    flex-wrap: wrap;
}

/* A channel's history: the Activity Log's rows, without the kind on each (they are all server changes) */
.smap-history .slog-chip {
    display: none;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    inset: 0;       /* (not 100vw by 100vh: on a phone that is larger than the screen while the browser's bars show) */
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: var(--shadow-dialog);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    /* a square to press and to ring when reached by keyboard, not the 16px-wide slot of the "×" itself */
    min-width: 24px;
    min-height: 24px;
    padding: 0;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
}

/* Themed replacement for the browser's confirm() box (askConfirm in common.js) */
.confirm-dialog {
    z-index: 3000;
}

.confirm-dialog .modal-content {
    width: 440px;
    max-width: calc(100vw - 32px);
}

.confirm-dialog .modal-body p {
    margin: 0;
    padding: var(--space-4) var(--space-6) var(--space-5);
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-normal);
    white-space: pre-line;
}

/* A dialog's text box or dropdown: the same room at its sides as the dialog's text */
.confirm-dialog .modal-body :is(input, select, textarea) {
    display: block;
    width: calc(100% - 2 * var(--space-6));
    margin: var(--space-4) var(--space-6) var(--space-5);
}

.confirm-dialog .modal-body p:not([hidden]) + :is(input, select, textarea) {
    margin-top: calc(-1 * var(--space-2));
}

/* Report to Discord (security.js): the steps, the report to paste, and the three ways out */
.sec-report-dialog {
    z-index: 3000;
}

.sec-report-dialog .modal-content {
    width: 640px;               /* its three buttons on one line */
    max-width: calc(100vw - 32px);
}

.sec-report {
    padding: var(--space-4) var(--space-6) var(--space-5);
}

.sec-report p,
.sec-report h3 {
    margin: 0;
}

.sec-report h3 {
    font-size: 0.95rem;
}

.sec-report-live {
    margin: 0;
    padding-left: var(--space-5);
}

.sec-report-live a {
    color: var(--accent);
}

.sec-report-text {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    resize: vertical;
}

.sec-report-dialog .modal-footer {
    flex-wrap: wrap;
}

/* The last warning before something is deleted for good or a lot changes at once (askTwice in common.js) */
.confirm-dialog.is-last .modal-content {
    border-color: var(--danger);
}

.confirm-dialog.is-last .modal-header h2 {
    color: var(--danger-text);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    border-top: 1px solid var(--border-color);
}

#joins-list-body tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    /* 24px to press; the negative margin keeps the line it sits in as tall as its neighbors */
    min-height: 24px;
    padding: 0;
    margin: calc(-1 * var(--space-1)) 0;
}

.btn-link:hover {
    color: var(--text-main);
}

/* Choices shown as pills (what a filter does, and its yes/no options) */
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.img-action-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

/* Out of sight but still reachable with Tab and Space, like the switches */
.img-action-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.img-action-pill input:focus-visible + span {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* A check mark as well as the color says which ones are chosen. Its room is kept while unchosen, so a pill
   doesn't grow when picked and the pills of stacked cards line up */
.img-action-pill span::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    visibility: hidden;
}

.img-action-pill input:checked + span::after {
    visibility: visible;
}

.img-action-pill span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out);
}

.img-action-pill:hover span {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-normal);
}

.img-action-pill input:checked+span {
    background: var(--accent-alpha);
    border-color: var(--accent);
    color: var(--text-main);
}

/* A custom command's actions (custom-commands.js): what the action is and its text on lines of their own,
   its smaller settings side by side */
#cc-actions .module-row > :is([data-key="type"], .module-field-textarea, .module-field-text) {
    grid-column: 1 / -1;
}

/* Remove: on a line of its own under the action, whatever the action holds (so the row keeps no room for it
   at its end, as a list's rows otherwise do) */
#cc-actions .module-row {
    padding-right: var(--space-3);
}

#cc-actions .module-row > .module-row-actions {
    position: static;
    grid-column: 1 / -1;
    min-height: 0;
    margin-top: 0;
}

/* ── Component overrides (Choices.js selects, recipient chips, misc) ──
   Moved from an inline <style> block in index.html; kept last so the
   cascade order is unchanged. */
/* Tag pickers (Choices.js): chosen items show as chips, the rest in a searchable list.
   Colors come from the theme so they match in light, dark and custom themes. */
.choices {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.choices[data-type*="select-multiple"] .choices__inner,
.choices[data-type*="select-one"] .choices__inner {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-normal);
    min-height: var(--control-height);
    font-size: 0.9rem;
    transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.choices[data-type*="select-multiple"] .choices__inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-0-5) var(--space-2);
    cursor: text;
}

.choices[data-type*="select-one"] .choices__inner {
    display: flex;
    align-items: center;
    padding: var(--space-1) var(--space-10) var(--space-1) var(--space-4);
    cursor: pointer;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.choices.is-open .choices__inner {
    border-radius: 6px 6px 0 0;
}

.choices.is-flipped.is-open .choices__inner {
    border-radius: 0 0 6px 6px;
}

.choices__list--multiple {
    display: contents;
}

.choices__input {
    background-color: transparent !important;
    color: var(--text-normal) !important;
    font-size: 0.88rem;
    margin: var(--space-0-5) 0 !important;
    padding: var(--space-0-5) !important;
}

.choices__input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Chosen items */
.choices__list--multiple .choices__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-0-5);
    margin: var(--space-0-5) var(--space-2) var(--space-0-5) 0;
    padding: var(--space-0-5) var(--space-2);
    background-color: color-mix(in srgb, var(--primary) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 999px;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    word-break: normal;
}

.choices__list--multiple .choices__item.is-highlighted {
    background-color: color-mix(in srgb, var(--primary) 28%, transparent);
    border-color: var(--primary);
}

.choices[data-type*="select-multiple"] .choices__button {
    width: 24px;
    height: 24px;
    margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-1)) calc(-1 * var(--space-1)) 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-size: 7px;
    opacity: 0.55;
    filter: var(--choices-x-filter, none);
}

.choices[data-type*="select-multiple"] .choices__button:hover,
.choices[data-type*="select-multiple"] .choices__button:focus-visible {
    opacity: 1;
    background-color: color-mix(in srgb, var(--text-main) 14%, transparent);
}

/* The list that opens */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    z-index: 1000;
    margin-top: -1px;
    background-color: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-float);
    color: var(--text-normal);
    word-break: normal;
}

.choices.is-open .choices__list--dropdown,
.choices.is-open .choices__list[aria-expanded] {
    border-color: var(--primary);
}

.is-flipped .choices__list--dropdown,
.is-flipped .choices__list[aria-expanded] {
    margin-top: 0;
    margin-bottom: -1px;
    border-radius: 8px 8px 0 0;
}

.choices__list--dropdown .choices__list,
.choices__list[aria-expanded] .choices__list {
    max-height: 260px;
    padding: var(--space-1);
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
    padding: var(--space-2) var(--space-2);
    border-radius: 6px;
    color: var(--text-normal);
    font-size: 0.88rem;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: color-mix(in srgb, var(--primary) 16%, transparent);
    color: var(--text-main);
}

.choices__list--dropdown .choices__item--selectable::after,
.choices__list[aria-expanded] .choices__item--selectable::after {
    display: none;
}

.choices__list--dropdown .choices__placeholder {
    display: none;
}

.choices__heading {
    padding: var(--space-2) var(--space-2) var(--space-1);
    border-bottom: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.choices__list--dropdown .choices__item.has-no-choices,
.choices__list--dropdown .choices__item.has-no-results {
    color: var(--text-muted);
}

.choices__list--dropdown .choices__input {
    margin: 0 !important;
    padding: var(--space-2) var(--space-2) !important;
    border-bottom: 1px solid var(--border-color);
}

.choices[data-type*="select-one"] .choices__item {
    color: var(--text-normal);
    background-color: transparent;
}

.choices[data-type*="select-one"]::after {
    right: 16px;
    border-color: var(--text-muted) transparent transparent;
}

.choices[data-type*="select-one"].is-open::after {
    border-color: transparent transparent var(--text-muted);
}

/* Ensure containers don't clip dropdowns. Not a card body that holds a table edge to edge (.is-flush): that
   one scrolls sideways when its table is wider than the card, which this rule used to switch off, so on a
   phone the table pushed the whole page wide instead. */
.settings-card,
.settings-card-body:not(.is-flush),
.accordion-item,
.accordion-content,
.accordion-content.active {
    overflow: visible !important;
}

    /* The words are blurred until the box is clicked. Only while it holds words: an empty box blurred its own
       "Separate with commas" into a smudge. */
    #banned-words-input:not(:focus):not(:placeholder-shown),
    #dynamic-words-input:not(:focus):not(:placeholder-shown) {
        filter: blur(5px);
    }
    #banned-words-input:focus,
    #dynamic-words-input:focus {
        filter: none;
    }

/* ── "Not in a server" state ──
   body.no-server is set by loadStats() when the bot has no guilds; stored data
   from servers it has left is hidden instead of being shown as current. */
.no-server-notice {
    display: none;
    align-items: center;
    gap: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--warning);
    border-radius: 12px;
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-8);
}

.no-server-notice > i {
    font-size: 1.4rem;
    color: var(--warning-text);
    flex-shrink: 0;
}

.no-server-text {
    flex: 1;
    min-width: 0;
}

.no-server-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--space-1);
}

.no-server-text p {
    font-size: 0.87rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.no-server-notice .btn {
    flex-shrink: 0;
    text-decoration: none;
}

body.no-server .no-server-notice {
    display: flex;
}

body.no-server :is(#dashboard-tab, #analytics-tab) > :not(.page-header):not(.no-server-notice) {
    display: none !important;
}

@media (max-width: 640px) {
    .no-server-notice {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Modules page ─────────────────────────────────────────────────────────── */
.module-category-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: var(--space-4) var(--space-4);
    box-shadow: var(--card-shadow);
}

/* On the Features page, what is switched on has a colored edge */
.module-card.is-on:not(.module-card-embedded) {
    border-color: rgba(var(--accent-rgb), 0.45);
}

.module-card-head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.module-card-head h3 {
    margin: 0 0 var(--space-1);
    font-size: 1rem;
    color: var(--text-main);
}

.module-card-head p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.module-card-head .module-commands {
    margin-top: var(--space-2);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--accent);
}

.module-body {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.module-form .form-group {
    margin-bottom: var(--space-4);
}

.module-form small {
    display: block;
    margin-top: var(--space-hint);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.module-form select[multiple] {
    min-height: 7rem;
}

.module-picker {
    min-width: 0;
}

.module-bool-control {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.module-bool-control > label:not(.toggle-switch) {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.88rem;
    color: var(--text-normal);
}

.module-rows {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.module-row {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-main);
}

.module-row-actions,
.module-form-actions {
    display: flex;
    justify-content: flex-end;
}

/* ── App shell ───────────────────────────────────────────────────────────────
   With a mouse, the top bar and the menu stay put and only the page area scrolls. The window's height is asked
   for as dvh where the browser knows it: a phone or tablet browser's own bars come and go, and 100vh is the
   height with them away, which is taller than what is on screen. */
html,
body {
    height: 100%;
}

body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.layout-wrapper {
    min-height: 0;
}

/* The scrolling page area: the page (.main-inner sets its width and padding), then the footer, at the bottom of
   the window or under a long page. The room at the end lets a dropdown near the bottom of a page open without
   being cut off; it is above the footer, which counts toward it. */
.main-content {
    flex: 1;
    width: 100%;
    min-width: 0;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
}

.main-inner {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--pad-page);
}

/* On a phone or a tablet (a finger, not a mouse) the page itself scrolls, as any web page does, and the top bar
   and a menu along the top scroll away with it. A page held to the window's height with scrolling switched off
   is what a phone's browser handles worst: on an iPhone the browser's own bars lay over the top and the end
   of it, and once anything had moved the page (a field brought into view, the keyboard) nobody could move it
   back, so the server picker and the menu stayed out of reach (reported 2026-10-07). A page that scrolls is the
   one thing every phone browser gets right: its bars make room for the page and give way as it moves.
   What goes with it: pageToTop() (common.js) scrolls the window as well as .main-content, and core.js
   measures --view-h from the window here. */
@media (pointer: coarse) {
    html,
    body {
        height: auto;
    }

    body {
        min-height: 100vh;
        min-height: 100dvh;
        overflow: visible;
    }

    .layout-wrapper {
        flex: 1 0 auto;
    }

    /* (clip, not hidden: hidden would make this a scrolling box again, and what is pinned inside it would pin
       to it instead of the screen. Something wider than the screen can't widen the page.) */
    .main-content {
        overflow: visible;
        overflow-x: clip;
    }

    /* A menu down the side stays beside the page while it scrolls, and scrolls by itself where it is taller
       than the screen */
    html:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        height: 100dvh;
    }

    html[data-nav-position="bottom"] {
        scroll-padding-bottom: var(--nav-bar-h);
    }

    /* An iPhone zooms the whole page in when a field with letters under 16px is tapped, and leaves it zoomed.
       (Pinching to zoom stays allowed: the page never asks for it to be switched off.) */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    /* A press needs 24px: a checkbox by itself in a table is 13px across, and a line of text with one in it
       16px tall */
    :is(td, th) > input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    :is(.sec-check, .wm-check) {
        min-height: 24px;
    }

    /* (the box itself, not only its line: "Watchlist only" was 13px across) */
    .sec-check > input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    /* The x on a chosen tag in a picker */
    .choices__list--multiple .choices__button {
        min-width: 24px;
        min-height: 24px;
        background-position: center;
    }
}

/* The menu on a phone. The top bar stays at the top of the screen with a Menu button in it, and the menu opens
   under it as a list over the page, wherever it sits and however it looks on a wider screen. Along the top it
   took three rows of a phone's screen on every page, down the side it was icons without their names, and after
   scrolling down a long page it was out of reach. common.js sets html[data-nav-drawer] ('closed' or 'open') on a
   phone and puts the position and the icons-only look aside while it holds, so the list below is the plain one.
   A phone is a screen for a finger that is narrow, or short (a phone held sideways); a tablet is neither. */
.nav-menu-button {
    display: none;
}

@media (pointer: coarse) and (max-width: 700px), (pointer: coarse) and (max-height: 500px) {
    .top-nav {
        position: sticky;
        top: 0;
    }

    .nav-menu-button {
        display: inline-flex;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: var(--control-height);
        height: var(--control-height);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-card);
        color: var(--text-main);
        font-size: 1rem;
        cursor: pointer;
    }

    .nav-menu-button[aria-expanded="true"] {
        border-color: var(--primary);
    }

    html:not([data-nav-drawer="open"]) .sidebar {
        display: none;
    }

    /* (from under the top bar, 58px tall, to the end of the screen; it scrolls by itself) */
    html[data-nav-drawer="open"] .sidebar {
        position: fixed;
        top: 58px;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
        width: auto;
        border-right: 0;
        overscroll-behavior: contain;
    }

    html[data-nav-drawer="open"][data-density="compact"] .sidebar {
        top: 50px;
    }
}

/* A strip across the bottom like the bars at the top (their color and line), its text lined up with the page */
.site-footer {
    margin-top: calc(var(--room-page-end) / 2);
    background-color: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.82rem;
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-6);
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--pad-page);
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
}

[data-width="wide"] .site-footer-inner {
    max-width: none;
}

.site-footer-legal {
    display: flex;
    align-items: center;
    gap: var(--gap-icon);
    margin: 0;
}

.brand-mark-sm {
    width: 20px;
    height: 20px;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-5);
}

.site-footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: var(--space-6);
    color: var(--text-muted);
    text-decoration: none;
}

.site-footer-links a:hover,
.site-footer-links a:focus-visible {
    color: var(--text-main);
    text-decoration: underline;
}

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

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
    gap: var(--space-4) var(--space-5);
}

.form-grid-3 > .form-group {
    margin: 0;
}

/* One field to a line (the staff roles on Permissions: three role pickers side by side, one of them two rows of
   chips tall beside two of one line) */
.form-grid-3.is-stacked {
    grid-template-columns: minmax(0, 1fr);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: var(--space-4) var(--space-5);
}

.form-grid-2 .form-group small,
.settings-card-body > .form-group small,
.module-group-body > .form-group small {
    margin-top: var(--space-hint);
    font-size: 0.78rem;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.card-actions small {
    margin-right: auto;
}

.color-field {
    display: flex;
    align-items: center;
    /* as tall as a field, so a color sits level with the field in the next column (it was 44px, which set the
       color 4px lower than its neighbor) */
    min-height: var(--control-height);
    gap: var(--space-2);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--text-normal);
}

.color-field input[type="color"] {
    width: 44px;
    height: var(--control-height);
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}

/* The six-digit code beside every color picker, to type or paste a color (common.js adds the box). It keeps
   its own width wherever it lands: beside a swatch in a form, a palette or the theme editor. */
input[type="text"].color-code {
    flex: 0 0 auto;
    width: 6.5rem;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
}

input[type="text"].color-code[aria-invalid] {
    border-color: var(--danger);
}

input[type="color"] {
    flex: 0 0 auto;
}

.settings-card-header-row {
    align-items: center;
}

/* A title on its own line of the header is as tall as the controls some headers hold beside it, so cards side
   by side keep their headers level whether or not they have any */
.settings-card-header > h3 {
    min-height: 1.875rem;
    margin-bottom: 0;
}

.chart-box {
    height: 260px;
    width: 100%;
    position: relative;
}

/* Sidebar groups are buttons, so they work from the keyboard */
button.category-header {
    width: 100%;
    background: none;
    border: 0;
    font-family: inherit;
    text-align: left;
}

.sidebar-category.collapsed .category-nav {
    display: none;
}

.nav li:focus-visible,
button.category-header:focus-visible,
.account-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ── Account menu (top right) ─────────────────────────────────────────────── */
.account {
    position: relative;
}

.account-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 240px;
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.account-btn:hover,
.account-btn[aria-expanded="true"] {
    border-color: var(--primary);
}

.account-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.account-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-normal);
    font-size: 0.72rem;
    font-weight: 700;
}

.account-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-caret {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-float);
    z-index: 200;
}

.account-menu-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    padding: var(--space-2) var(--space-2) var(--space-2);
    margin-bottom: var(--space-1);
    border-bottom: 1px solid var(--border-color);
}

.account-menu-head strong {
    font-size: 0.88rem;
    color: var(--text-main);
}

.account-menu-head span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2);
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--text-normal);
    font: inherit;
    font-size: 0.86rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

/* An item that is on or off ("Show everything") shows a check mark while it is on */
.account-menu-item[aria-checked="true"]::after {
    content: '\f00c';
    margin-left: auto;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--accent);
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
    background: var(--bg-tertiary);
    color: var(--text-main);
    outline: none;
}

.account-menu-sep {
    height: 1px;
    margin: var(--space-2) var(--space-0-5);
    background: var(--border-color);
}

/* ── Overview ─────────────────────────────────────────────────────────────── */
/* In one column, what needs attention comes before the chart */
@media (max-width: 1000px) {
    .overview-side {
        order: -1;
    }
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    margin-bottom: var(--space-8);
    align-items: start;
}

.overview-side {
    display: flex;
    flex-direction: column;
}

/* The Activity card grows toward the column beside it, and its chart takes the room, up to a chart's height: the
   card once ended a third of the way down the list of joins, above an empty corner, and when it was made as tall
   as that list instead the chart towered (519px wide, 580px in a half-screen window, running off a 900px-high
   screen with its lines near vertical). The canvas is out of the flow, so the chart can also shrink again when
   that column does. In one column the chart keeps its usual height. */
.overview-grid > .settings-card {
    display: flex;
    flex-direction: column;
    align-self: start;
}

.overview-grid > .settings-card > .settings-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.overview-grid > .settings-card .chart-box {
    flex: none;         /* (flex: 1 with a canvas out of the flow left the box 0px tall in a card of its own height) */
    height: 380px;
}

.overview-grid > .settings-card .chart-box canvas {
    position: absolute;
    inset: 0;
}

.overview-grid .settings-card,
.overview-side .settings-card {
    margin-bottom: 0;
}

.settings-card-body.attention-list {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.info-value.is-due {
    color: var(--warning-text);
}

.info-value.is-clear {
    color: var(--text-muted);
    font-weight: 500;
}

.attention-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--space-2) 0;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    font: inherit;
    text-align: left;
    color: inherit;
}

.attention-row:last-child {
    border-bottom: 0;
}

/* In the Everything view a row has a second, quieter line (the total behind its count). A row without one
   (Risky members) is as tall as the rows that have it. */
html[data-detail="full"] .attention-row {
    min-height: calc(var(--space-12) + 1px);
}

/* (a recent join is a button too, for people who can open that member's profile) */
button.attention-row,
button.recent-join {
    cursor: pointer;
}

button.attention-row:hover .info-label,
button.recent-join:hover .recent-join-name {
    color: var(--text-main);
}

.recent-join {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) 0;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    font: inherit;
    text-align: left;
    color: inherit;
}

.recent-join:last-child {
    border-bottom: 0;
}

.recent-join-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-normal);
}

/* What a row says on the right, with a quieter line under it (the total behind a count that needs attention) */
.attention-meta small {
    font-size: inherit;
    font-weight: 500;
}

.recent-join-meta,
.attention-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.recent-join-meta .is-new {
    color: var(--warning-text);
    font-weight: 600;
}

/* Modules shown on their feature's page read like the page's other cards */
.module-mount:empty {
    display: none;
}

.module-card-embedded {
    border-radius: 10px;
}

.module-card-embedded .module-body {
    margin-top: var(--space-4);
}

.module-card-embedded .module-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 0 var(--space-5);
}

.module-card-embedded .module-form > .module-field-rows,
.module-card-embedded .module-form > .module-field-textarea,
.module-card-embedded .module-form > .module-form-actions {
    grid-column: 1 / -1;
}

/* ── Aligned field grids ─────────────────────────────────────────────────────
   Fields in a grid share three rows: label, control, hint. A label that wraps
   to two lines grows the label row for the whole line of fields, so every box
   in that line still starts at the same height. */
.form-grid-2 {
    row-gap: 0;
}

.form-grid-2 > .form-group,
.module-card-embedded .module-form > .module-field {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);    /* (a picker's longest choice can't widen it past its card) */
    row-gap: 0;
}

.form-grid-2 > .form-group > label,
.module-card-embedded .module-form > .module-field > label {
    align-self: end;
}

/* Controls keep their own height when a taller list sits beside them */
.form-grid-2 > .form-group > :nth-child(2),
.module-card-embedded .module-form > .module-field > :nth-child(2),
.form-grid-2 > .form-group > small,
.module-card-embedded .module-form > .module-field > small {
    align-self: start;
}

/* A line worked out for this server under a setting's help (the honeypot's catches): a fact, so not in the hint's
   gray, on a line of its own */
.module-field .module-status {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-normal);
}

/* A switch sits on the control row, as tall as the boxes beside it, so the two are level */
.module-card-embedded .module-form > .module-field-bool > .module-bool-control {
    grid-row: 2;
    min-height: var(--control-height);
}

.module-card-embedded .module-form > .module-field-bool > small {
    grid-row: 3;
}

/* ── Appearance page ──────────────────────────────────────────────────────── */
.appearance-section {
    margin-bottom: var(--space-8);
}

.appearance-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.appearance-section-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 var(--space-1);
}

.appearance-section-head p {
    margin: 0;
    font-size: 0.85rem;
}

.appearance-head-actions {
    display: flex;
    flex-wrap: wrap;            /* (in a longer language the third button goes under the others) */
    gap: var(--space-2);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr));
    gap: var(--space-3);
}

.theme-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.theme-tile:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
}

.theme-tile.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.theme-tile-pick {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.theme-tile-pick:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.theme-tile-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: var(--space-1);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.theme-tile-detail {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* (a word in the page, not the stylesheet's, so it is translated with the rest) */
.theme-tile-mark {
    display: none;
}

.theme-tile.is-selected .theme-tile-mark {
    display: inline;
    flex-shrink: 0;             /* the name wraps instead, never this word */
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
}

.theme-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: var(--pad-chip);
}

.theme-swatches {
    display: flex;
    height: 30px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.theme-swatches span {
    flex: 1;
}

.theme-tile-actions {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-color);
}

.theme-tile-action {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.theme-tile-action:hover:not(:disabled) {
    color: var(--text-main);
    border-color: rgba(var(--accent-rgb), 0.5);
}

.theme-tile-action.is-danger:hover:not(:disabled) {
    color: var(--danger-text);
    border-color: color-mix(in srgb, var(--danger) 50%, transparent);
}

.theme-tile-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.theme-tile-action:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.server-default-row {
    max-width: 420px;
    margin: 0 0 var(--space-5);
}

#theme-editor,
#theme-share,
#theme-import {
    margin-bottom: var(--space-5);
}

.theme-editor-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: var(--space-3);
    align-items: end;
}

.theme-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: var(--space-2) var(--space-4);
    margin: var(--space-2) 0 var(--space-3);
}

.theme-color {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--text-normal);
    cursor: pointer;
}

.theme-color input[type="color"] {
    width: 38px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}

.theme-warnings {
    margin: var(--space-3) 0 0;
    padding-left: var(--space-4);
    font-size: 0.82rem;
    color: var(--warning-text);
}

.theme-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.theme-preview-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-right: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.layout-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(165px, 100%), 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.layout-preset {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.layout-preset:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
}

.layout-preset.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.layout-preset-name {
    margin-top: var(--space-1);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}

.layout-preset-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Miniature page drawn with boxes: sidebar on the left, content lines on the right */
.layout-mini {
    display: flex;
    gap: var(--space-1);
    height: 58px;
    padding: var(--space-2);
    border-radius: 6px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
}

.layout-mini-side {
    width: 26%;
    border-radius: 3px;
    background: var(--bg-tertiary);
}

.layout-mini-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-0-5) 0;
}

.layout-mini-main span {
    height: 9px;
    border-radius: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.layout-mini-main span:first-child {
    width: 55%;
    background: rgba(var(--accent-rgb), 0.35);
    border-color: transparent;
}

.layout-mini-compact .layout-mini-main {
    gap: var(--space-1);
}

.layout-mini-compact .layout-mini-main span {
    height: 7px;
}

.layout-mini-focus .layout-mini-side {
    width: 9%;
}

.layout-mini-focus .layout-mini-main {
    padding: var(--space-0-5) 12%;
}

.layout-mini-large .layout-mini-main span {
    height: 12px;
}

.layout-options {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.layout-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.layout-option:last-child {
    border-bottom: 0;
}

.layout-option-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-normal);
}

.layout-option select {
    width: auto;
    min-width: 200px;
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;            /* its choices go onto a second line on a phone, never off the screen */
    padding: var(--space-1);
    gap: var(--space-1);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.segmented button {
    padding: var(--space-1) var(--space-3);
    background: none;
    border: 0;
    border-radius: 5px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.segmented button:hover {
    color: var(--text-main);
}

.segmented button.is-selected {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 0 0 1px var(--border-color), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.segmented button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ── Personal layout options (set on <html> from the person's preferences) ── */
html[data-text-size="small"] {
    font-size: 14.5px;
}

html[data-text-size="large"] {
    font-size: 17.5px;
}

[data-width="wide"] .main-inner {
    max-width: none;
}

[data-density="compact"] .page-header { margin-bottom: var(--space-5); padding-bottom: var(--space-4); }
[data-density="compact"] .top-nav { height: 50px; }
[data-density="compact"] .nav li { padding: var(--space-2) var(--space-2); }
[data-density="compact"] .sidebar-category { margin-bottom: var(--space-3); }
[data-density="compact"] .top-level-nav { margin-bottom: var(--space-3); padding-bottom: var(--space-3); }

[data-motion="reduced"] *,
[data-motion="reduced"] *::before,
[data-motion="reduced"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* The device's reduce-motion setting, unless the person chose Animation: Always on. Nothing travels, turns or
   grows (tokens.css makes the --move-* times nothing) and no animation runs; a color or an opacity still fades. */
@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="on"]) *,
    :root:not([data-motion="on"]) *::before,
    :root:not([data-motion="on"]) *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* Icons-only sidebar: chosen in Appearance, and automatic on narrower screens */
[data-sidebar="icons"] .sidebar { width: 64px; padding: var(--space-4) var(--space-2); }
[data-sidebar="icons"] .sidebar .category-header { display: none; }
[data-sidebar="icons"] .sidebar .sidebar-category { margin-bottom: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }
[data-sidebar="icons"] .sidebar .sidebar-category.collapsed .category-nav { display: block; }
[data-sidebar="icons"] .sidebar .top-level-nav { margin-bottom: var(--space-2); padding-bottom: 0; border-bottom: 0; }
[data-sidebar="icons"] .nav li { justify-content: center; padding: var(--space-2) 0; }
[data-sidebar="icons"] .nav li span { display: none; }
[data-sidebar="icons"] .nav li i { width: auto; font-size: 1rem; }

@media (max-width: 1000px) {
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar { width: 64px; padding: var(--space-4) var(--space-2); }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar .category-header { display: none; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar .sidebar-category { margin-bottom: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar .sidebar-category.collapsed .category-nav { display: block; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .sidebar .top-level-nav { margin-bottom: var(--space-2); padding-bottom: 0; border-bottom: 0; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .nav li { justify-content: center; padding: var(--space-2) 0; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .nav li span { display: none; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .nav li i { width: auto; font-size: 1rem; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .nav-pinned-label { display: none; }
    html:root:not([data-nav-position="top"]):not([data-nav-position="bottom"]):not([data-nav-drawer]) .nav-pinned { margin-bottom: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }
    .account-name,
    .logo-version {
        display: none;
    }

    .overview-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* (in one column the chart keeps a chart's usual height) */
    .overview-grid > .settings-card .chart-box {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .top-nav {
        padding: 0 var(--space-3);
    }

    /* (the mark that goes with the name leaves with it: it stood alone beside the logo) */
    .logo .brand-name,
    .logo .brand-tm {
        display: none;
    }

    /* The server's name gives way before the bar does: with a 13-letter name on a 360px phone the account
       button ran 7px past the edge, because nothing between the bar and the name was allowed to shrink */
    .logo,
    .server-switcher {
        min-width: 0;
    }

    .user-menu {
        flex-shrink: 0;
    }

    .server-switcher-btn {
        max-width: min(160px, 100%);
    }

    .page-header {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    /* On its own line, so several buttons wrap instead of running off the screen */
    .header-actions {
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .layout-option {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ── Security Center ─────────────────────────────────────────────────────────
   Status colors mean risk levels only, and always come with an icon and a label. */
:root {
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical: #d03b3b;
}

/* The light look has its own steps (after the ones above, which a rule further up would lose to): the
   yellow above is 1.8:1 on white, for an icon or a word */
[data-theme="light"] {
    --status-good: #0b7a0b;
    --status-warning: #946000;
    --status-serious: #b8491a;
    --status-critical: #c53030;
}

.sec-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--status-warning);
    border-radius: 8px;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    font-size: 0.88rem;
    color: var(--text-normal);
}

.sec-banner p {
    margin: 0;
}

.sec-status {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    margin-bottom: var(--space-4);
}

.sec-threat,
.sec-protections {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: var(--space-4) var(--space-5);
}

.sec-threat {
    border-left: 4px solid var(--status-good);
}

.sec-threat-elevated { border-left-color: var(--status-warning); }
.sec-threat-high { border-left-color: var(--status-serious); }
.sec-threat-critical { border-left-color: var(--status-critical); }

.sec-threat-level {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.sec-threat-level i { color: var(--status-good); }
.sec-threat-elevated .sec-threat-level i { color: var(--status-warning); }
.sec-threat-high .sec-threat-level i { color: var(--status-serious); }
.sec-threat-critical .sec-threat-level i { color: var(--status-critical); }

.sec-threat-caption {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sec-threat-level strong {
    font-size: 1.35rem;
    color: var(--text-main);
}

.sec-threat-reasons {
    margin: var(--space-2) 0 0 var(--space-4);
    font-size: 0.86rem;
    color: var(--text-normal);
    line-height: 1.5;
}

.sec-threat p {
    margin: var(--space-2) 0 0;
    font-size: 0.86rem;
}

.sec-protections {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sec-prot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.86rem;
}

.sec-prot-label {
    font-weight: 600;
    color: var(--text-normal);
}

.sec-prot-state {
    color: var(--text-muted);
}

/* A line with no button (Discord's raid detection) ends where the buttons of the lines above it do */
.sec-prot-state:last-child {
    grid-column: 2 / -1;
    justify-self: end;
}

.sec-prot-state.is-paused {
    color: var(--text-main);
    font-weight: 600;
}

.sec-note {
    margin: var(--space-1) 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* The risk queue and the latest joins, with the cards beside them only while the first column has room for its
   tables (about 800px). In a narrower window, or with the menu taking room on the left, the cards go below, where
   two fixed columns would cut a table's last columns off */
.sec-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: var(--space-6);
}

.sec-main,
.sec-side {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sec-main {
    flex: 1.6 1 800px;
}

/* The narrow column stays in view beside the long one: it is a third as tall, and scrolled away it left the
   rest of the queue and all of the latest joins beside an empty column */
.sec-side {
    flex: 1 1 280px;
    position: sticky;
    top: var(--space-4);
}

/* Latest joins: account age and the invite used, with the risk chip */
.sec-joins-age {
    white-space: nowrap;
}

.sec-joins-age.is-new {
    color: var(--status-warning);
    font-weight: 600;
}

.sec-layout .settings-card,
.sec-trends .settings-card {
    margin-bottom: 0;
}

.sec-queue-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--pad-card-x) 0;
}

/* What the search of the server's history for old spam found, between the queue's title and its filters */
.sec-history-note {
    margin: 0;
    padding: var(--space-3) var(--pad-card-x) 0;
    font-size: 0.85rem;
}

/* The accounts that search found and are still here, with the button that cleans up after them */
.sec-history-found {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-2) var(--pad-card-x) 0;
    font-size: 0.85rem;
}

.sec-history-found p {
    margin: 0;
}

.sec-queue-filters .settings-select,
.sec-queue-filters input[type="search"] {
    width: auto;
    min-width: 170px;
}

.sec-check {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.85rem;
    color: var(--text-normal);
}

.sec-queue-body {
    overflow-x: auto;
}

/* A table that shares a card's body with other things (the queue under its figures and filters, a chart's
   numbers) starts and ends where they do: with a cell's own padding its header stood in from them */
:is(.sec-queue-body, .sec-table-wrap) .data-table :is(th, td):first-child {
    padding-left: 0;
}

:is(.sec-queue-body, .sec-table-wrap) .data-table :is(th, td):last-child {
    padding-right: 0;
}

.sec-who {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    min-width: 220px;
}

.sec-who .sec-avatar {
    margin-top: var(--space-0-5);
}

.sec-who-name {
    display: block;
    font-weight: 600;
    color: var(--text-main);
}

/* (and an applicant's or voucher's, Applications and Vouches) */
.sec-avatar,
.app-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.sec-avatar-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-normal);
    font-size: 0.8rem;
    font-weight: 700;
}

.sec-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
}

.sec-risk {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sec-score {
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.sec-score-lg {
    font-size: 1.2rem;
}

.sec-bar {
    width: 48px;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.sec-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--status-good);
}

.sec-bar-elevated { background: var(--status-warning); }
.sec-bar-high { background: var(--status-serious); }
.sec-bar-critical { background: var(--status-critical); }

.sec-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pad-chip);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.sec-chip-low i { color: var(--status-good); }

/* Start here: a goal that is all set, in its switch's place */
.setup-done {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--status-good);
    white-space: nowrap;
}
.sec-chip-elevated i { color: var(--status-warning); }
.sec-chip-high i { color: var(--status-serious); }
.sec-chip-critical i { color: var(--status-critical); }

.sec-why {
    display: block;
    margin-top: var(--space-1);
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

/* (and the same tags under the name on a member's own page, where there is room for all of them) */
.sec-tags,
.mem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-1);
}

.sec-tag {
    padding: var(--pad-chip);
    border-radius: 4px;
    background: var(--bg-tertiary);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-normal);
}

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

.sec-empty {
    margin: 0;
    padding: var(--space-2) 0;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.sec-link {
    min-height: 24px;
    padding: 0;
    margin: calc(-1 * var(--space-1)) 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.sec-warning {
    margin: 0 0 var(--space-2);
    font-size: 0.85rem;
    color: var(--danger-text);
}

/* The briefing: how the week went on one side, with its trends, and what it calls for on the other (who to
   look at, what to do), with a line between them. A week that calls for nothing is just the first part. */
.sec-briefing-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: var(--space-5) var(--space-8);
}

.sec-briefing-body.is-short {
    grid-template-columns: minmax(0, 1fr);
}

.sec-briefing-week {
    max-width: 68ch;
}

.sec-briefing-week section {
    margin-top: var(--space-4);
}

.sec-briefing-calls {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-left: var(--space-8);
    border-left: 1px solid var(--border-color);
}

.sec-briefing-body p {
    margin: 0 0 var(--space-2);
    font-size: 0.87rem;
    line-height: 1.5;
    color: var(--text-normal);
}

.sec-briefing-body p:last-child {
    margin-bottom: 0;
}

.sec-briefing-body .sec-briefing-headline {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
}

.sec-briefing-body h4 {
    margin: 0 0 var(--space-1);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sec-briefing-body ul {
    margin: 0 0 0 var(--space-4);
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-normal);
}

@media (max-width: 1000px) {
    .sec-briefing-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .sec-briefing-calls {
        padding: var(--space-5) 0 0;
        border-left: 0;
        border-top: 1px solid var(--border-color);
    }
}

/* On a phone the button for a new briefing drops under the heading instead of squeezing it */
@media (max-width: 640px) {
    #sec-briefing > .settings-card-header {
        flex-wrap: wrap;
    }
}

/* VirusTotal: what's checked, and a lookup anyone with Write can make */
.sec-vt-body > p {
    margin: 0 0 var(--space-3);
    font-size: 0.87rem;
    line-height: 1.5;
    color: var(--text-normal);
}

.sec-vt-form {
    display: flex;
    gap: var(--gap-row);
    min-width: 0;
}

.sec-vt-form .settings-input {
    flex: 1;
    min-width: 0;
}

.sec-vt-result:not(:empty) {
    margin-top: var(--space-3);
}

/* A VirusTotal key of the server's own, under the lookup box: one quiet line, or the box to type it into */
.sec-own-key {
    margin: var(--space-3) 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Your own keys on Settings (settings.js _renderOwnKeys): a block for each service, its name over a line saying
   which key is used and what can be done. The box for a key keeps a usable width: on a phone its two buttons go
   under it. */
.own-key + .own-key {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.own-key p {
    margin: 0;
}

.own-key p + p,
.own-key p + form,
.own-key form + p {
    margin-top: var(--space-2);
}

.own-key-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.own-key-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-row);
    min-width: 0;
}

.own-key-form .settings-input {
    flex: 1 1 220px;
    min-width: 0;
}

.own-key-form .btn {
    min-height: var(--control-height);      /* as tall as the box beside them, on a line of their own too */
}

.sec-vt-result p {
    margin: 0;
    font-size: 0.85rem;
}

.sec-vt-answer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-row);
    font-size: 0.85rem;
}

.sec-vt-name {
    min-width: 0;
    color: var(--text-main);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sec-event-vt {
    margin: var(--space-1) 0;
    padding-left: var(--space-4);
    font-size: 0.82rem;
    color: var(--text-normal);
    overflow-wrap: anywhere;
}

.sec-event-vt a {
    margin-left: var(--space-2);
}

.sec-feed {
    display: flex;
    flex-direction: column;
    padding-top: var(--space-1);
}

.sec-event {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: start;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
}

.sec-event:last-child {
    border-bottom: 0;
}

/* While any entry has a button ("Mark handled"), every entry keeps the room one takes, so the times stand in
   one column: an entry without the button had its time out at the card's edge, away from the others */
.sec-feed:has(.sec-event > .btn) .sec-event {
    grid-template-columns: 20px minmax(0, 1fr) minmax(6.5rem, auto);
}

.sec-event > .btn {
    justify-self: end;
}

/* On a phone the button goes under its entry, so the words take the width beside the icon (in a third column
   they wrapped every two or three words) */
@media (max-width: 640px) {
    .sec-event,
    .sec-feed:has(.sec-event > .btn) .sec-event {
        grid-template-columns: 20px minmax(0, 1fr);
    }

    .sec-event > .btn {
        grid-column: 2;
        justify-self: start;
    }
}

.sec-event-icon {
    margin-top: var(--space-1);
    color: var(--text-muted);
}

.sec-event-icon.sec-event-elevated { color: var(--status-warning); }
.sec-event-icon.sec-event-high { color: var(--status-serious); }
.sec-event-icon.sec-event-critical { color: var(--status-critical); }

.sec-event-head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    font-size: 0.84rem;
    color: var(--text-main);
}

.sec-event-body p {
    margin: var(--space-0-5) 0;
    font-size: 0.84rem;
    color: var(--text-normal);
    overflow-wrap: anywhere;
}

.sec-event-people {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: 0.8rem;
}

.sec-event blockquote,
.sec-ai-item blockquote {
    margin: var(--space-1) 0;
    padding: var(--space-1) var(--space-2);
    border-left: 3px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-normal);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sec-trends-head {
    display: flex;
    flex-wrap: wrap;            /* (the ranges go under the heading on a phone) */
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin: var(--space-2) 0 var(--space-3);
}

.sec-trends-head h2,
.sec-settings-title {
    font-size: 1.05rem;
    color: var(--text-main);
}

.sec-settings-title {
    margin: 0 0 var(--space-3);
}

.sec-trends {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    margin-bottom: var(--space-8);
}

/* A chart's numbers as a table (security.js secDrawChart): the newest week, with "Show all" for the rest, so
   nothing scrolls inside the page; the columns' names wrap, so six of them fit the card */
.sec-table-wrap {
    overflow-x: auto;
}

/* (.data-table in the selector: without it the table's own "white-space: nowrap", written further down, won) */
.sec-table-wrap .data-table th {
    white-space: normal;
    vertical-align: bottom;
}

/* (seven columns in half a page: with half the room between them they also fit beside a menu at the side) */
.sec-table-wrap .data-table :is(th, td) {
    padding-inline: var(--space-1);
}

.sec-chart-empty {
    margin: 0 0 var(--space-2);
    font-size: 0.85rem;
}

#wl-security-modules {
    display: flex;
    flex-direction: column;
    gap: var(--space-page);
}

.sec-member-modal {
    width: 760px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.sec-member-modal .modal-body {
    padding: var(--space-5) var(--space-6);
}

.sec-member-modal h3 {
    margin: var(--space-5) 0 var(--space-2);
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sec-member-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.sec-member-head p {
    margin: var(--space-1) 0 0;
    font-size: 0.82rem;
}

.sec-member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.sec-profile-form {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.sec-profile-form summary {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}

.sec-profile-form p {
    margin: var(--space-2) 0;
    font-size: 0.8rem;
}

.sec-profile-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.sec-profile-row .settings-select {
    width: auto;
}

.sec-profile-row .settings-input {
    flex: 1;
    min-width: 180px;
}

/* Plain lists, with no bullets and no room of their own (and the Applications and Server Tools pages' lists) */
.sec-contribs,
.app-history,
.tools-findings,
.tools-errors {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sec-contribs li {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: start;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-normal);
}

.sec-contribs li small {
    display: block;
    overflow-wrap: anywhere;
}

.sec-contrib-weight {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
}

.sec-contribs li.is-trust .sec-contrib-weight {
    color: var(--text-muted);
}

.sec-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-1) var(--space-4);
    margin: var(--space-4) 0 0;
    font-size: 0.85rem;
}

.sec-facts dt {
    color: var(--text-muted);
}

.sec-facts dd {
    margin: 0;
    color: var(--text-normal);
    overflow-wrap: anywhere;
}

.sec-ai-item {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-normal);
}

.sec-ai-item p {
    margin: var(--space-1) 0;
}

.sec-ai-item ul {
    margin: var(--space-1) 0 0 var(--space-4);
}

/* The name of a list in a finding ("What Equinox found", "Patterns") */
.sec-ai-item > small {
    display: block;
    margin-top: var(--space-2);
}

.sec-evidence {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 320px;
    overflow-y: auto;
}

.sec-message {
    padding: var(--space-2) var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-main);
}

.sec-message-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-normal);
}

.sec-message p {
    margin: var(--space-1) 0 0;
    font-size: 0.84rem;
    color: var(--text-main);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sec-message-head a,
.sec-ai-item a {
    color: var(--accent);
}

.sec-history {
    margin: 0 0 0 var(--space-4);
    font-size: 0.84rem;
    color: var(--text-normal);
}

.ai-usage {
    margin-top: var(--space-1);
    font-size: 0.85rem;
    color: var(--text-normal);
}

.ai-usage p {
    margin: 0 0 var(--space-2);
}

.ai-usage-invalid_key,
.ai-usage-no_credit,
.ai-usage-forbidden,
.ai-usage-error {
    color: var(--danger-text);
}

.ai-usage table {
    max-width: 520px;
    margin-top: var(--space-2);
}

@media (max-width: 1000px) {
    .sec-status,
    .sec-trends {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* On a phone a line's words sit together and its button stays on that line, so a button can't read as the next line's */
@media (max-width: 640px) {
    .sec-prot {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-block: var(--space-2);
        border-bottom: 1px solid var(--border-color);
    }

    .sec-prot:last-of-type {
        border-bottom: 0;
    }

    .sec-prot-state {
        grid-column: 1;
        grid-row: 2;
    }

    .sec-prot-state:last-child {
        grid-column: 2;
        grid-row: 1;
    }

    .sec-prot .btn {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: center;
    }

    /* Small buttons are still fingers' targets */
    .btn-sm {
        min-height: 36px;
    }

    /* Members: who, how long here and the risk beside the name; the rest is a press away, in their profile */
    .mem-col-phone-off {
        display: none;
    }

    .apps-who .mem-risk-phone {
        display: flex;
        margin-top: var(--space-1);
    }
}

[hidden] {
    display: none !important;
}

/* Part of a page that belongs to a switched-off feature (core.js setHiddenTabs) */
.feature-off {
    display: none !important;
}

/* ── Applications and Vouches pages ─────────────────────────────────────────
   Left: the server's applications. Right: what members sent, or an
   application's setup. Vouches reuse the list and detail styles. */
.link-button {
    /* 24px to press; the negative margin keeps the line it sits in as tall as its neighbors (as .btn-link) */
    min-height: 24px;
    margin: calc(-1 * var(--space-1)) 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

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

.apps-tabs,
.apps-filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-0-5);
    padding: var(--space-0-5);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* (the bar is the control height: its tabs, its 2px of padding and its border) */
.apps-tab,
.apps-filter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: calc(var(--control-height) - var(--space-1) - 2px);
    padding: 0 var(--space-3);
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.apps-tab:hover,
.apps-filter:hover {
    color: var(--text-main);
}

.apps-tab.is-active,
.apps-filter.is-active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.apps-filter-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.apps-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.apps-toolbar-end {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* A picker beside the search is as wide as its words: at its usual 100% it claimed the row and squeezed the
   search box until its placeholder was cut off ("Search name, ID or reasor") */
.apps-toolbar-end > .settings-select {
    width: auto;
}

/* (wide enough for its longest hint, "Search name, ID or invite code", which 240px cut short) */
.apps-search {
    width: 300px;
    max-width: 100%;
}

.data-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* Inside a card a table has no box of its own (it was a box in the card's box): it runs from edge to edge of
   the card under a line, and as the last thing in the card down to the card's bottom edge. */
.settings-card-body:not(.is-flush) > .data-table-wrap,
.settings-card-body:not(.is-flush) > :is(.stack, :only-child) > .data-table-wrap {
    margin-inline: calc(-1 * var(--pad-card-x));
    border-width: 1px 0;
    border-radius: 0;
    background: none;
}

/* (first in the card: straight under the card's header, whose line is its top line) */
.settings-card-body:not(.is-flush) > .data-table-wrap:first-child,
.settings-card-body:not(.is-flush) > :is(.stack, :only-child):first-child > .data-table-wrap:first-child {
    margin-top: calc(-1 * var(--pad-card-y));
    border-top: 0;
}

.settings-card-body:not(.is-flush) > .data-table-wrap:last-child,
.settings-card-body:not(.is-flush) > :only-child > .data-table-wrap:last-child {
    margin-bottom: calc(-1 * var(--pad-card-y));
    border-bottom: 0;
    border-radius: 0 0 9px 9px;         /* the card's corners, inside its border */
}

/* A table's first and last columns keep a card's side padding. In a card they start under the card's title and
   end where its buttons do; a table that is its own box (Ticket panels, Your applications, Your forms) starts
   where the cards under it do, which it missed by half that padding. */
:is(.settings-card-body.is-flush, .data-table-wrap) .data-table :is(th, td):first-child {
    padding-left: var(--pad-card-x);
}

:is(.settings-card-body.is-flush, .data-table-wrap) .data-table :is(th, td):last-child {
    padding-right: var(--pad-card-x);
}

/* A row's buttons sit at the row's end, whichever table it is */
.data-table td:last-child:has(> .cell-actions) {
    text-align: right;
}

/* Tables: one look on every page; .data-table-compact for dense lists */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    padding: var(--pad-cell);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

/* A short cell that reads badly broken over lines */
.data-table .nowrap {
    white-space: nowrap;
}

.data-table td {
    padding: var(--pad-cell);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-normal);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table-compact th,
.data-table-compact td {
    padding: var(--pad-cell-compact);
    font-variant-numeric: tabular-nums;
}

/* A row that stands for the whole table: loading, nothing to show, or an error */
.data-table .table-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--text-muted);
}

.data-table .table-empty.is-error {
    color: var(--danger-text);
}

/* A table with nothing in it yet, in a card as tall as a longer one beside it (Analytics): the table takes the
   card's height, so its one line sits in the middle of the card and not at the top of an empty box */
.settings-card:has(> .is-flush .table-empty) {
    display: flex;
    flex-direction: column;
}

.settings-card:has(> .is-flush .table-empty) > .is-flush {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.settings-card:has(> .is-flush .table-empty) .data-table {
    flex: 1;
}

.table-empty > i:first-child {
    margin-right: var(--gap-icon);
}

/* Buttons side by side in a table cell */
.cell-actions {
    display: inline-flex;
    flex-wrap: wrap;            /* on a phone the second one goes under the first, never off the screen */
    align-items: center;
    gap: var(--gap-row);
}

/* A button whose words are wider than its row ("Change the message or add join roles" on a phone) takes a
   second line for them instead of leaving its card. In a table they stay on one line: the table scrolls. */
:is(.cell-actions, .settings-card-header-row, .header-actions, .bk-status, .bot-profile-buttons, .module-rows) > .btn {
    white-space: normal;
}

.data-table .cell-actions > .btn {
    white-space: nowrap;
}

/* In a table a row's buttons stay side by side (a table scrolls sideways before a cell breaks). Left to wrap,
   a column that takes the spare room (width: 100%) pressed this one down to one button's width, and Edit sat
   on top of Delete in every row. */
.data-table td > .cell-actions {
    flex-wrap: nowrap;
}

/* On a phone a table that scrolls sideways keeps its row's buttons in view: the last column, when it holds them,
   stays at the right edge and the rest scrolls under it (Edit and Delete were off the screen on Ticketing,
   Applications and Embeds, with nothing to say they were there) */
@media (max-width: 640px) {
    .data-table td:last-child:has(> .cell-actions),
    .data-table:has(td:last-child > .cell-actions) th:last-child {
        position: sticky;
        right: 0;
        background: var(--bg-card);
        box-shadow: -1px 0 0 var(--border-color), -12px 0 12px -8px var(--shadow-primary),
                    -12px 0 12px -8px var(--shadow-primary);   /* (twice: once is too faint on a dark card) */
    }
}

/* An invite's code, as it is typed in Discord */
.invite-code {
    margin-right: var(--space-2);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 600;
    color: var(--accent);
}

/* A card body that holds a table edge to edge */
.settings-card-body.is-flush {
    padding: 0;
    overflow-x: auto;
}

/* A box that scrolls cuts off what opens out of it, so a picker's list in the table (Channel Restrictions'
   "Also allowed") ended at the card's edge. While one is open the box lets it out, on a screen where the table
   fits its card anyway (on a narrower one it keeps scrolling sideways). */
@media (min-width: 1001px) {
    .settings-card-body.is-flush:has(.choices.is-open) {
        overflow: visible;
    }
}

/* Channel Restrictions' table. The note about the rule for threads sits under the table (in a row's cell it
   pushed that row's select out of line with the other controls), and a row that has a role doesn't keep
   "Add roles" beside it: in a cell this narrow the two words went onto a line of their own and made that row
   taller than the others, so the box to type in takes no room until the picker is open. */
#restrictions-threads-note {
    position: sticky;       /* (stays in view while the table beside it scrolls sideways on a phone) */
    left: 0;
    margin: 0;
    padding: var(--space-inner) var(--pad-card-x);
}

/* (room for a role's name on one line: the "Allows" choices' long names took the row's width and left this
   column 170px in a half-screen window, where a chip wrapped inside itself and doubled the row) */
#restrictions-table :is(th, td):nth-child(3) {
    min-width: 220px;
}

/* The channel, the two switches and Remove take only the room they need, and "Allows" the rest: a picked choice
   is cut off mid-word by its box, never ended with "...", so its longest choice has to fit in a half-screen
   window (1100px) */
#restrictions-table :is(th, td):is(:nth-child(1), :nth-child(4), :nth-child(5), :nth-child(6)) {
    width: 1%;
}

#restrictions-table .cr-channel {
    min-width: 160px;       /* (a channel's name whole: at its own width "#suggestions" lost its last letter) */
}

#restrictions-table .choices__list--multiple:not(:empty) + .choices__input {
    min-width: 2ch !important;      /* (over the width the picker writes on the box for its placeholder) */
}

#restrictions-table .choices:not(.is-open) .choices__list--multiple:not(:empty) + .choices__input {
    width: 0 !important;
    min-width: 0 !important;
}

#restrictions-table .choices__list--multiple:not(:empty) + .choices__input::placeholder {
    color: transparent;
}

/* Alignment utilities win over component rules, as utilities should */
.text-end {
    text-align: right !important;
}

/* A card beside a taller one that keeps its own height: one with a chart of a fixed height, or one that is
   often empty (an empty line was floating in a card stretched to ten rows beside it) */
.self-start {
    align-self: start;
}

.text-center {
    text-align: center !important;
}

.apps-row {
    cursor: pointer;
}

.apps-row:hover,
.apps-row:focus-visible {
    background: var(--bg-tertiary);
    outline: none;
}

.apps-col-check {
    width: 36px;
}

/* A list that is narrowed by tabs or a filter keeps its columns where they are. Left to the browser, each was
   as wide as what the rows on show happened to hold, so the headings moved from one tab to the next (and all
   of them when a filter left the list empty). Sent applications, and the bans. On a screen where the table is
   wider than its card it scrolls sideways, and the browser's own widths serve it better. */
@media (min-width: 1001px) {
    .apps-col-who {
        width: 34%;
    }

    .apps-col-short {
        width: 14%;
    }

    #bans-table th:nth-child(1) {
        width: 26%;
    }

    #bans-table th:is(:nth-child(2), :nth-child(4)) {
        width: 15%;
    }

    #bans-table th:nth-child(5) {
        width: 18%;
    }
}

.apps-who {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.apps-who > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.apps-who-name {
    color: var(--text-main);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-who-id {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.app-avatar-blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 700;
}

.apps-none {
    padding: var(--space-10) var(--space-4);
    text-align: center;
    color: var(--text-muted);
}

.apps-loading {
    padding: var(--space-4) var(--space-4);
}

/* A state in a table or a card (an application's, a vouch's, a suggestion's) is the one state chip every page
   has, a dot and a word (.state-chip, further down): it was a filled pill beside the outlined chips of the same
   page. The word is always there; the color says how it stands. */
.app-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pad-chip);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-status::before {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* (a suggestion's state, Suggestions page, takes the same three colors) */
.app-status-pending,
.sugg-status-considering {
    color: var(--warning-text);
}

.app-status-accepted,
.sugg-status-approved {
    color: var(--success-text);
}

.app-status-denied,
.sugg-status-denied {
    color: var(--danger-text);
}

.apps-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.apps-template {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-darker);
    color: var(--text-normal);
    font: inherit;
    font-size: 0.84rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--motion-fast) var(--ease-out);
}

.apps-template strong {
    color: var(--text-main);
    font-size: 0.92rem;
}

.apps-template:hover,
.apps-template.is-selected {
    border-color: var(--primary);
}

.apps-template.is-selected {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.apps-new .modal-content {
    width: 720px;
    max-width: calc(100vw - 32px);
}

.apps-new-body {
    padding: var(--space-4) var(--space-6);
}

.apps-new-label {
    margin: var(--space-4) 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.apps-new .apps-templates {
    margin-top: var(--space-2);
}

/* Setup */
.apps-note {
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* (a note above a group's fields: it changes what they mean, as a forum does for where applications go) */
.apps-note.is-above {
    margin: 0 0 var(--space-4);
}

.apps-preview-wrap {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

/* The words over an editor's preview (core.js previewLabel), written as the labels of the fields beside it are */
.preview-label {
    margin: 0 0 var(--space-label);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.apps-preview {
    max-width: 560px;
}

.apps-panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-4);
}

/* One submission or vouch */
.app-detail .app-detail-content {
    width: 1040px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
}

.app-detail-head {
    gap: var(--space-4);
}

.app-detail-head h2 {
    font-size: 1.1rem;
}

.app-detail-head-end {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.app-detail-body {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
    gap: var(--space-5);
    padding: var(--space-4) var(--space-6);
    overflow-y: auto;
}

.app-answers {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.app-answer h4 {
    margin: 0 0 var(--space-1);
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.app-answer p {
    margin: 0;
    color: var(--text-main);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* An answer that was pasted in, and how it reads: said between the question and the answer */
.app-answer p.app-answer-mark {
    margin-bottom: var(--space-1);
    color: var(--warning-text);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
}

.app-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.app-side-card {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.86rem;
}

.app-side-card h4 {
    margin: 0 0 var(--space-2);
    color: var(--text-main);
    font-size: 0.86rem;
}

.app-side-card p {
    margin: var(--space-2) 0 0;
    line-height: 1.45;
}

.app-side-card textarea {
    width: 100%;
    margin-bottom: var(--space-2);
}

.app-fact {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-1) 0;
}

.app-fact > :last-child {
    text-align: right;
    overflow-wrap: anywhere;
}

.app-list {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-4);
}

.app-list li {
    margin: var(--space-0-5) 0;
}

.app-ai-note {
    font-size: 0.75rem;
}

.app-history li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
}

.app-history li:last-child {
    border-bottom: 0;
}

.app-history p {
    flex-basis: 100%;
    margin: var(--space-0-5) 0 0;
    color: var(--text-muted);
    white-space: pre-wrap;
}

.app-detail-foot {
    align-items: center;
}

.app-detail-spacer {
    flex: 1;
}

.app-decided {
    font-size: 0.85rem;
}

/* Ranked tables (Analytics): the place, the name, and one or more counts. The table sets padding and lines. */
.data-table .lb-rank {
    width: 1%;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .lb-name {
    overflow-wrap: anywhere;
}

/* In a ranked table a name keeps to one line and is cut with "..." (the whole name is its tip): one long name on
   two lines made its row taller, and the rows of the tables beside it no longer lined up */
.data-table .lb-rank + .lb-name {
    width: 100%;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table .lb-count {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Permissions: which applications a role can see */
.perm-app-scope {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

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

    .apps-search {
        width: 100%;
    }
}

/* On a phone the buttons, picker and search take a row of their own and the search fills what is left of it (the
   box was sized by its contents, so "100%" of it left the search at 249px while the pickers under it were full
   width); a row that is still too long wraps instead of running off the screen */
@media (max-width: 640px) {
    .apps-toolbar-end {
        flex: 1 1 100%;
        flex-wrap: wrap;
        min-width: 0;
    }

    .apps-search {
        flex: 1 1 160px;
        min-width: 0;
        width: auto;
    }
}

/* Lists inside settings (questions, strike punishments, boost times...): one box per entry with its fields
   side by side. A list of single fields is numbered, with no repeated label. */
.module-rows {
    counter-reset: module-row;
}

/* An entry's fields stand in columns, so one that goes onto a second line starts under the first and is as wide
   as the ones above it (left to stretch, "Lasts (hours)" ran the whole width under three fields that each ended
   somewhere else). They line up along their labels: aligning bottoms lifted a field whose help text made it
   taller. Remove has a place of its own at the end of the first line: as the last thing in the line it dropped
   under the fields, alone, whenever they filled the row. */
.module-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));   /* (12.5rem: a date with its time fits) */
    align-items: start;
    gap: var(--space-2) var(--space-4);
    /* (the room at the end is Remove's: a button of the control height with the gap the fields keep between them;
       sized for the small button it once was, the first box ran up against it and they read as one) */
    padding: var(--space-2) calc(var(--space-12) * 2 + var(--space-5)) var(--space-2) var(--space-3);
}

.module-form .module-row > .module-field {
    flex: 1 1 200px;        /* (in a numbered list of single fields, which stays a line: below) */
    min-width: 0;
    margin-bottom: 0;
}

.module-row > .module-field-bool > .module-bool-control {
    min-height: 44px;
}

/* A switch is on the line of the boxes beside it, not on the line of their labels (its own line is 44px tall,
   for fingers, and a box is 36px) */
.module-row:has(> .module-field:not(.module-field-bool)) > .module-field-bool {
    margin-top: calc(var(--space-6) - var(--space-1));
}

/* (on a phone an entry's fields are one column, and a switch has no box beside it to be level with) */
@media (max-width: 640px) {
    .module-row:has(> .module-field:not(.module-field-bool)) > .module-field-bool {
        margin-top: 0;
    }
}

/* A time or a date is as wide as its column, as the boxes beside it are */
.module-form .module-row input:is([type=time], [type=datetime-local]) {
    max-width: none;
}

.module-row > .module-row-actions {
    position: absolute;
    top: var(--space-2);
    right: var(--space-3);
    align-items: center;
    min-height: var(--control-height);
    margin-top: var(--space-6);   /* level with the first line's boxes, below their labels */
}

.module-row:not(:has(> .module-field ~ .module-field)) > .module-row-actions {
    margin-top: 0;
}

/* (a numbered list of single fields stays a line: its number, the field, Remove) */
.module-row:not(:has(> .module-field ~ .module-field)) {
    display: flex;
    align-items: center;
}

.module-row:not(:has(> .module-field ~ .module-field)) > .module-field > label {
    display: none;
}

.module-row:not(:has(> .module-field ~ .module-field))::before {
    counter-increment: module-row;
    content: counter(module-row) ".";
    min-width: 1.4em;
    color: var(--text-muted);
    font-weight: 600;
}

/* On a phone Remove's room at the end of the box goes to the fields (they were half the box wide, with an empty
   strip beside them, and Remove lay over the first box), and Remove comes last in the flow, under them */
@media (max-width: 640px) {
    .module-row {
        padding-right: var(--space-3);
    }

    .module-row > .module-row-actions {
        position: static;
        margin-top: 0;
    }
}

/* ── The application editor (applications.js renderAppSetup) ─────────────────
   About a screen long: its name and questions open, the other groups of options folded into rows. */

/* Its first card has no title: the bar above already names the application */
#apps-editor .apps-setup-card[data-group="basics"] > .module-body {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* A folded group says what is set on one line; the row opens to every field */
.apps-setup-list .mod-row-desc {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apps-setup-list .mod-row-panel {
    padding-right: 0;
}

/* The panel's settings with its preview beside them, where there is room */
@media (min-width: 1100px) {
    .apps-setup-list [data-group="panel"] > .mod-row-panel {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
        column-gap: var(--space-6);
        align-items: start;
    }

    .apps-setup-list [data-group="panel"] > .mod-row-panel > :is(.mod-row-about, .apps-panel-actions) {
        grid-column: 1 / -1;
    }

    /* Beside the settings the preview starts level with them, with no line above it */
    .apps-setup-list [data-group="panel"] > .mod-row-panel > .apps-preview-wrap {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }
}

/* On a narrower screen the preview comes first, over the settings it shows, as in the other editors */
@media (max-width: 1099px) {
    .apps-setup-list [data-group="panel"] > .mod-row-panel {
        display: flex;
        flex-direction: column;
    }

    .apps-setup-list [data-group="panel"] > .mod-row-panel > .mod-row-about {
        order: -2;
    }

    .apps-setup-list [data-group="panel"] > .mod-row-panel > .apps-preview-wrap {
        order: -1;
        margin-top: 0;
        margin-bottom: var(--space-4);
        padding-top: 0;
        border-top: 0;
    }
}

/* The titles of the questions' columns: shown on a wide screen only, where each question is one line */
.apps-q-head {
    display: none;
}

/* Each question on one line: its number, the question, how it is answered, a check on a typed answer, whether it
   must be answered. What only some need (the choices of a list, a pattern) goes on a line under it. The titles are
   said once above the list, and each control keeps its own label for screen readers. On a narrow screen the
   questions stack as every other list of rows does. */
@media (min-width: 761px) {
    #apps-editor .apps-setup-card[data-group="questions"] .module-rows {
        align-items: stretch;
    }

    #apps-editor .apps-setup-card[data-group="questions"] :is(.apps-q-head, .module-row) {
        display: grid;
        grid-template-columns: var(--space-6) minmax(0, 1fr) 215px 180px 72px 72px;   /* (215: "They pick from a list" in full) */
        align-items: center;
        gap: var(--space-1) var(--space-2);
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-rows > .btn {
        align-self: flex-start;
    }

    #apps-editor .apps-q-head {
        padding-bottom: var(--space-1);
        color: var(--text-muted);
        font-size: 0.74rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    #apps-editor .apps-q-head > :nth-child(5) {
        text-align: center;
    }

    #apps-editor .module-rows:not(:has(> .module-row)) > .apps-q-head {
        display: none;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row {
        padding: var(--space-1) 0;
        background: none;
        border: 0;
        border-radius: 0;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row::before {
        counter-increment: module-row;
        content: counter(module-row);
        grid-area: 1 / 1;
        color: var(--text-muted);
        font-size: 0.85rem;
        font-weight: 600;
        text-align: right;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="question"] { grid-area: 1 / 2; }
    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="kind"] { grid-area: 1 / 3; }
    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="check"] { grid-area: 1 / 4; }
    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="required"] { grid-area: 1 / 5; justify-self: center; margin-top: 0; }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > .module-row-actions {
        position: static;
        grid-area: 1 / 6;
        min-height: 0;
        margin: 0;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > :is([data-key="options"], [data-key="pattern"]) {
        grid-area: 2 / 2 / auto / 5;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        column-gap: var(--space-2);
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > :is([data-key="options"], [data-key="pattern"]) > label {
        margin: 0;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="pattern"] > small {
        grid-column: 2;
    }

    /* The box already says "Separate with commas" */
    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="options"] > small {
        display: none;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > :is([data-key="question"], [data-key="kind"], [data-key="check"]) > label,
    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="required"] .module-bool-control > label:not(.toggle-switch) {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row > [data-key="required"] > .module-bool-control {
        min-height: var(--control-height);
    }

    /* Remove is there on every line, so it is quiet until pointed at */
    #apps-editor .apps-setup-card[data-group="questions"] .module-row-actions > .btn {
        background: none;
        border-color: transparent;
        color: var(--text-muted);
    }

    #apps-editor .apps-setup-card[data-group="questions"] .module-row-actions > .btn:is(:hover, :focus-visible) {
        background: color-mix(in srgb, var(--danger) 14%, transparent);
        color: var(--danger-text);
    }
}

/* A popup's questions (Forms, a ticket type's, Vouches': modules.js renderRows with head) look as an application's
   do: each a line under its columns' titles, said once. Its number, the question, how it is answered, whether it
   must be, Remove. The hint and the answer's lengths, which only the Everything view shows, go on a line under it
   with their own labels. On a narrow screen the questions stack as every other list of rows does. */
.q-head {
    display: none;
}

/* A question's choices take a line of their own under it */
.q-list > .module-row > [data-key="options"] {
    grid-column: 2 / -1;
}

@media (min-width: 761px) {
    /* (the titles run the list's width, as the rows do; Add keeps its own) */
    .q-list {
        align-items: stretch;
    }

    .q-list > .btn {
        align-self: flex-start;
    }

    .q-list > :is(.q-head, .module-row) {
        display: grid;
        grid-template-columns: var(--space-6) minmax(0, 1fr) 180px 80px 88px;
        align-items: center;
        gap: var(--space-1) var(--space-2);
    }

    .q-list > .q-head {
        padding-bottom: var(--space-1);
        color: var(--text-muted);
        font-size: 0.74rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    /* (a column of switches has its title over the switches' middle: Required, and Vouches' Long answer) */
    .q-list > .q-head > :nth-child(4),
    .q-list:has(> .module-row > [data-key="long"]) > .q-head > :nth-child(3) {
        text-align: center;
    }

    .q-list:not(:has(> .module-row)) > .q-head {
        display: none;
    }

    .q-list > .module-row {
        padding: var(--space-1) 0;
        background: none;
        border: 0;
        border-radius: 0;
    }

    .q-list > .module-row::before {
        counter-increment: module-row;
        content: counter(module-row);
        grid-area: 1 / 1;
        color: var(--text-muted);
        font-size: 0.85rem;
        font-weight: 600;
        text-align: right;
    }

    .q-list > .module-row > :is([data-key="question"], [data-key="label"]) { grid-area: 1 / 2; }
    .q-list > .module-row > :is([data-key="style"], [data-key="long"]) { grid-area: 1 / 3; }
    .q-list > .module-row > [data-key="required"] { grid-area: 1 / 4; justify-self: center; }
    .q-list > .module-row > [data-key="placeholder"] { grid-area: 2 / 2; }
    .q-list > .module-row > [data-key="min_length"] { grid-area: 2 / 3; }
    .q-list > .module-row > [data-key="max_length"] { grid-area: 2 / 4 / auto / 6; }

    /* (a switch on its row's line: the rule that sets one level with the boxes beside it, below their labels,
       counts on labels these lines don't show) */
    .q-list > .module-row > .module-field.module-field-bool {
        margin-top: 0;
    }

    .q-list > .module-row > [data-key="long"] {
        justify-self: center;
    }

    .q-list > .module-row > .module-field-bool > .module-bool-control {
        min-height: var(--control-height);
    }

    .q-list > .module-row > .module-row-actions {
        position: static;
        grid-area: 1 / 5;
        min-height: 0;
        margin: 0;
    }

    .q-list > .module-row > :is([data-key="question"], [data-key="label"], [data-key="style"]) > label,
    .q-list > .module-row > .module-field-bool .module-bool-control > label:not(.toggle-switch) {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    /* Remove is there on every line, so it is quiet until pointed at */
    .q-list > .module-row > .module-row-actions > .btn {
        background: none;
        border-color: transparent;
        color: var(--text-muted);
    }

    .q-list > .module-row > .module-row-actions > .btn:is(:hover, :focus-visible) {
        background: color-mix(in srgb, var(--danger) 14%, transparent);
        color: var(--danger-text);
    }
}

/* A list under a heading that already says what it is needs no label of its own */
.apps-setup-card[data-group="questions"] .module-field-rows > label,
.tp-type .module-field-rows > label,
#cc-actions > .module-field-rows > label {
    display: none;
}

/* Settings that don't apply right now (like Choices on a typed answer) */
.module-field[hidden] {
    display: none !important;
}

/* Popup questions (Forms page, ticket types): the hint and the answer lengths are for the Everything view */
:root:not([data-detail="full"]) :is(#forms-editor, .tp-type) .module-row > :is([data-key="placeholder"], [data-key="min_length"], [data-key="max_length"]) {
    display: none;
}

/* Each question of a form or a ticket type: its text on one line, its answer settings below */
.module-row > [data-key="question"] {
    grid-column: 1 / -1;
}

/* A vouch's question has two switches beside it, and the room of two columns to be read in (from 761px the
   questions are a line each instead: .q-list) */
@media (min-width: 641px) and (max-width: 760px) {
    .module-field[data-key="questions"] .module-row > [data-key="label"] {
        grid-column: span 2;
    }
}

/* ── Ticket panel editor (tickets.js) ────────────────────────────────────────
   A ticket type is a card of generated fields: what every type needs, then sections that fold away. */
.tp-type > .module-card-head {
    align-items: center;
}

.tp-type > .module-card-head h3 {
    margin: 0;
}

/* A line about a folding section, across the top of it */
.module-group-note {
    grid-column: 1 / -1;
    margin: 0 0 var(--space-field);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.section-title-row.is-centered h2 {
    margin: 0;
}

.apps-setup-card[data-group="questions"] .module-field-rows {
    margin-bottom: var(--space-4);
}

/* Export menu on the applications list */
.apps-export {
    position: relative;
}

.apps-export > summary {
    list-style: none;
    cursor: pointer;
}

.apps-export > summary::-webkit-details-marker {
    display: none;
}

.apps-export-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-width: 170px;
    padding: var(--space-1);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-float);
}

.apps-export-menu a {
    padding: var(--space-2) var(--space-2);
    border-radius: 6px;
    color: var(--text-normal);
    font-size: 0.86rem;
    text-decoration: none;
}

.apps-export-menu a:hover,
.apps-export-menu a:focus-visible {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

/* Color settings in module and application forms: the box is .color-field's, as tall as the boxes beside it
   (a second size for it here, 56 by 44, set it lower than its neighbors again); its color fills it */
.module-field-color input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.module-field-color input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 4px;
}

/* The bot's profile in this server (Settings page): a Discord-style card beside the fields */
.bot-profile {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.bot-profile-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.bot-profile-banner {
    height: 96px;
    background: color-mix(in srgb, var(--primary) 55%, var(--bg-tertiary));
    background-position: center;
    background-size: cover;
}

.bot-profile-avatar {
    position: absolute;
    top: 52px;
    left: 16px;
    width: 80px;
    height: 80px;
    border: 5px solid var(--bg-darker);
    border-radius: 50%;
    background: var(--bg-darker);
    object-fit: cover;
}

.bot-profile-body {
    padding: var(--space-12) var(--space-4) var(--space-4);
}

.bot-profile-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-main);
    font-size: 1.05rem;
}

.bot-profile-body p {
    margin: var(--space-2) 0 0;
    color: var(--text-normal);
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bot-profile-fields > .form-group {
    margin-bottom: var(--space-4);
}

.bot-profile-images {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
}

.bot-profile-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* As tall as the row of pictures beside it, with its buttons in the middle, so Avatar's and Banner's buttons
   sit level */
.bot-profile-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-height);
}

.bot-profile-buttons label.btn {
    cursor: pointer;
}

.bot-profile-buttons label.btn:focus-within {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Upload, for a server without Equinox Premium: off, like a disabled button */
.bot-profile-buttons label.btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bot-profile-premium {
    display: block;
    margin-top: var(--space-2);
}

/* ── Equinox Premium: a gold crown beside what only it opens, on every server (core.js premiumBadge) ── */
.premium-crown,
.premium-badge {
    color: var(--premium-text);
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: var(--space-2);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

/* What only Premium opens, on a server without it: still there, quieter, and it leads to Settings instead
   (core.js premiumLocked) */
.is-premium-locked {
    opacity: 0.75;
}

/* Settings, Equinox Premium: this server's plan, then the servers a buyer's Premium covers */
.premium-plan {
    display: grid;
    gap: var(--space-3);
}

.premium-servers {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.premium-servers > li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* The bot's picture: its usual one, then the same picture in other colors, then Upload. Round, as Discord
   shows an avatar, in every corner style. */
.bot-avatar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.bot-avatar-choices {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.bot-avatar-choice {
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-darker);
    overflow: hidden;
    cursor: pointer;
}

.bot-avatar-choice img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-avatar-choice:hover {
    border-color: var(--text-muted);
}

.bot-avatar-choice:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.bot-avatar-choice[aria-pressed="true"],
.bot-banner-kept[aria-pressed="true"] {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* The banner a server uploaded, kept beside Upload: a banner's shape, as tall as the buttons */
.bot-banner-kept {
    height: var(--space-6);
    aspect-ratio: 17 / 6;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-darker);
    overflow: hidden;
    cursor: pointer;
}

.bot-banner-kept img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-banner-kept:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* What a server uploaded and can't use without Premium: still there, dimmed */
.bot-avatar-choice:disabled,
.bot-banner-kept:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* "Make your own avatar": the last of the profile's fields and as wide as they are. A row each for the
   background and the letters, the name down the side so the two rows of colors line up. */
.module-group.bot-avatar-own {
    margin: var(--space-4) 0 0;
}

.bot-avatar-own .module-group-body {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3) var(--space-5);
    padding-bottom: var(--space-4);
}

.bot-avatar-own .bot-profile-label {
    margin: 0;
}

.bot-avatar-own .cp-row {
    margin-top: 0;
}

/* The picker and its code say "custom" by themselves here */
.bot-avatar-own .cp-custom span {
    display: none;
}

.bot-avatar-own small {
    grid-column: 1 / -1;
}

@media (max-width: 600px) {
    .bot-avatar-own .module-group-body {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2);
    }

    .bot-avatar-own .cp-row {
        margin-bottom: var(--space-2);
    }
}

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

/* ── Developer and Server Tools pages ───────────────────────────────────────── */
.tools-tabs {
    margin-bottom: var(--space-5);
}

.tools-body {
    display: flex;
    flex-direction: column;
}

.tools-card {
    margin: 0;
}

/* Text in these cards is the size of the rest of the dashboard's */
.tools-card .settings-card-body {
    color: var(--text-normal);
    font-size: 0.9rem;
}

/* A switch beside the fields of a form sits level with them */
.resp-switch {
    min-height: 2.5rem;
}

/* Past incidents: a row each, which opens to its report and timeline */
.resp-past + .resp-past {
    border-top: 1px solid var(--border-color);
}

.resp-past > summary {
    padding: var(--space-2) 0;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
}

.resp-past > summary small {
    margin-left: var(--space-2);
    font-weight: 400;
}

.resp-past[open] {
    padding-bottom: var(--space-4);
}

.resp-past > .stat-row {
    margin: var(--space-2) 0 var(--space-4);
}

.tools-card .settings-card-header p {
    margin: var(--space-0-5) 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tools-major {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border-color));
}

.tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

.tools-row:last-child {
    border-bottom: 0;
}

.tools-row strong {
    color: var(--text-main);
    font-size: 0.92rem;
}

.tools-row p {
    margin: var(--space-0-5) 0 0;
    font-size: 0.82rem;
    overflow-wrap: anywhere;    /* a path or an ID longer than the row breaks, and doesn't stick out of the card */
}

/* The text gives way: it wraps inside the row, whatever the row's width, and a name too long for one line is cut.
   (max-width: stacked on a phone, the text is as wide as its longest line unless it is held to the row) */
.tools-row > :first-child {
    min-width: 0;
    max-width: 100%;
}

/* The control at a row's end keeps its size. A row of text alone has no control: its only child is the text, and
   told not to shrink it ran past the card in a window between a phone's width and a wide one's */
.tools-row > :last-child:not(:first-child) {
    flex-shrink: 0;
}

.tools-inline,
.tools-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
}

.tools-inline .settings-select,
.tools-inline .settings-input {
    width: auto;
    min-width: 180px;
}

.tools-form .form-group {
    margin: 0;
    min-width: 220px;
}

.tools-grow {
    flex: 1;
}

.tools-check {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    color: var(--text-normal);
    font-size: 0.88rem;
    cursor: pointer;
}

/* (the theme editor's "Preview on this page" is the same kind of box: it was the browser's own blue and size) */
.tools-check input,
.theme-preview-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.tools-actions-top {
    margin: 0 0 var(--space-3);
}

a.btn.is-disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Setup check */
.tools-summary {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: 10px;
}

.tools-summary > div {
    flex: 1;
}

.tools-summary strong {
    color: var(--text-main);
}

.tools-summary p {
    margin: var(--space-0-5) 0 0;
    font-size: 0.85rem;
}

.tools-summary > i {
    font-size: 1.4rem;
}

.tools-summary.is-good { border-left-color: var(--success); }
.tools-summary.is-good > i { color: var(--success-text); }
.tools-summary.is-warn { border-left-color: var(--warning); }
.tools-summary.is-warn > i { color: var(--warning-text); }
.tools-summary.is-bad { border-left-color: var(--danger); }
.tools-summary.is-bad > i { color: var(--danger-text); }

/* Start here: "Walk in as a new member", the steps in the order they happen */
.walk-in { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.walk-in li.is-warn > i { color: var(--warning-text); margin-right: var(--gap-icon); }

/* Nothing half-done (modules.js _modProblems): a feature that is on but can't do its job as it is set */
.global-notice.mod-problems { align-items: flex-start; }
.global-notice.mod-problems > i { margin-top: var(--space-0-5); }
.mod-problems > div { flex: 1; min-width: 0; }
.mod-problem-list { margin: var(--space-1) 0 0; padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.mod-problem-features { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.mod-problem-features .mod-problem-list { margin-top: var(--space-0-5); }
.mod-row-warn { color: var(--warning-text); margin-left: var(--gap-icon); }

.tools-findings li {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-normal);
    font-size: 0.88rem;
}

.tools-findings li:last-child {
    border-bottom: 0;
}

.tools-findings li > span:not(.tools-area) {
    flex: 1;
}

.tools-area {
    flex: 0 0 130px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tools-findings li.is-problem > i { color: var(--danger-text); }
.tools-findings li.is-warning > i { color: var(--warning-text); }

.tools-grid {
    display: grid;
    /* (min(): a column never asks for more room than there is, so on a phone it is one column, not a page
       that scrolls sideways) */
    grid-template-columns: repeat(auto-fit, minmax(min(var(--tools-col, 320px), 100%), 1fr));
    gap: var(--space-4);
}

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

.tools-list li {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-normal);
    font-size: 0.88rem;
}

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

.tools-bars {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    height: 90px;
    margin-top: var(--space-4);
}

.tools-bar {
    display: flex;
    flex: 1;
    min-width: 0;               /* seven bars share the card's width, however narrow it is */
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: var(--space-1);
}

.tools-bar span {
    width: 100%;
    min-height: 2px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tools-bar small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.tools-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-5);
    margin: 0;
    font-size: 0.88rem;
}

.tools-facts dt {
    color: var(--text-muted);
}

.tools-facts dd {
    margin: 0;
    color: var(--text-main);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.tools-errors li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

.tools-errors li:last-child {
    border-bottom: 0;
}

.tools-error-head {
    display: flex;
    flex-wrap: wrap;            /* on a phone the tags and the date go under the name, never past the card's edge */
    align-items: center;
    gap: var(--space-1) var(--space-2);
}

.tools-error-head small {
    margin-left: auto;
}

.tools-errors p {
    margin: var(--space-1) 0 0;
    color: var(--text-normal);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.tools-errors pre {
    max-height: 260px;
    margin: var(--space-2) 0 0;
    padding: var(--space-3);
    overflow: auto;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-normal);
    font-size: 0.76rem;
    white-space: pre-wrap;
}

.tools-errors summary {
    margin-top: var(--space-1);
    color: var(--accent);
    font-size: 0.82rem;
    cursor: pointer;
}

/* The notice from the bot owner, and maintenance mode, above every page */
.global-notice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.88rem;
}

.global-notice > i {
    color: var(--accent);
}

.global-notice.is-warning {
    background: color-mix(in srgb, var(--warning) 12%, var(--bg-card));
    border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}

.global-notice.is-warning > i {
    color: var(--warning-text);
}

/* A link in a notice stands on a tinted card, where the link color alone is just under the bar in the dark look
   (4.36 to 1 on the warning tint: Lighthouse found it on "Some features can't do their job as they are set"). It
   goes a fifth of the way toward the words' own color, which reads on both tints in every look and with every
   accent (tests/test_ui_standards.py) */
.global-notice .btn-link,
.global-notice a:not(.btn) {
    color: color-mix(in srgb, var(--accent) 80%, var(--text-main));
}

.global-notice .btn-link:hover,
.global-notice a:not(.btn):hover {
    color: var(--text-main);
}

/* Developer page lock */
.dev-lock .settings-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    text-align: center;
}

.dev-lock h3 {
    margin: 0;
    color: var(--text-main);
}

.dev-lock p {
    margin: 0;
    font-size: 0.9rem;
}

.dev-lock-icon {
    margin-bottom: var(--space-1);
    color: var(--accent);
    font-size: 1.8rem;
}

.dev-lock-form {
    align-items: stretch;
    justify-content: center;
    margin-top: var(--space-3);
}

.dev-lock-form .settings-input {
    width: 260px;
}

/* Developer page: the bot's current pictures (Bot Identity) */
.dev-identity-pictures {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.dev-identity-pictures .app-avatar {
    width: 64px;
    height: 64px;
}

.dev-identity-banner {
    max-width: 240px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
}

/* Equinox Console (console.html): who is signed in, beside Sign out (its sign-in screen is the .gate) */
.console-account {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.global-notice > span {
    flex: 1;
}

/* A preference with a line of explanation under its name */
.layout-option-text {
    flex: 1;
    min-width: 0;
}

.layout-option-text p {
    margin: var(--space-0-5) 0 0;
    font-size: 0.82rem;
}

/* Invite selection is for people who can edit invites */
body:not(.can-edit-invites) .invite-edit-only {
    display: none !important;
}

@media (max-width: 700px) {
    .tools-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Members ─────────────────────────────────────────────────────────────────── */
.mem-count {
    margin: 0;
    font-size: 0.88rem;
}

/* A row of filters, each under its label (Members, Activity Log). They share the row between them, so its ends line
   up with the table under it whatever number of filters shows; on a narrow screen they wrap. */
.mem-filters,
.slog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.mem-filter {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.mem-filter > span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mem-filter .settings-select {
    width: 100%;
}

.mem-table td {
    white-space: nowrap;
}

.mem-table td:nth-child(2),
.mem-table td:nth-child(3) {
    white-space: normal;
}

.mem-sub {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.mem-roles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    max-width: 320px;
}

.mem-roles-wrap {
    max-width: none;
}

.mem-role {
    --role-color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 180px;
    padding: var(--space-0-5) var(--space-2);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-normal);
    font-size: 0.76rem;
    line-height: 1.5;
}

.mem-role > span:not(.mem-role-dot) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mem-role-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--role-color);
}

.mem-role-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: calc(-1 * var(--space-1));
    padding: 0;
    background: none;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
}

.mem-role-remove:hover,
.mem-role-remove:focus-visible {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
    color: var(--text-main);
}

.mem-more {
    align-self: center;
    color: var(--text-muted);
    font-size: 0.76rem;
}

/* A member's name with what they are beside it (bot, owner, staff...), on the one line: a long name gives way
   before a tag does, and a tagged row is no taller than any other */
.mem-risk-phone {
    display: none;
}

.mem-name-line {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.mem-name-line .mem-tag,
.mem-name-line .sec-tag {
    flex-shrink: 0;
}

/* The same line in Threat Detection's tables (Watching, Left beside the name). The tag is kept as tall as the
   name beside it, or the row would grow by a pixel */
.sec-who > div {
    min-width: 0;
}

.mem-name-line .sec-tag {
    line-height: 1.15;
}

.mem-name-line .sec-who-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.mem-tags:empty {
    display: none;
}

.mem-tag {
    padding: var(--pad-chip);
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.mem-tag.is-owner { color: var(--warning-text); }
.mem-tag.is-staff { color: var(--accent); }
.mem-tag.is-warn { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--text-main); }
.mem-tag.is-boost { background: color-mix(in srgb, #f47fff 18%, transparent); color: var(--text-main); }

.mem-bulk {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: color-mix(in srgb, var(--primary) 10%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-color));
    border-radius: 10px;
}

.mem-bulk .settings-select {
    width: auto;
    min-width: 180px;
}

.mem-bulk-count {
    margin-right: var(--space-1);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.88rem;
}

.mem-bulk progress {
    flex: 1;
    min-width: 160px;
    height: 8px;
    accent-color: var(--primary);
}

.mem-result {
    position: relative;
    margin-bottom: var(--space-3);
    padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--warning);
    border-radius: 10px;
    font-size: 0.86rem;
}

/* A big kick or ban waiting for a second person: what it is, and the buttons to decide on it */
.mem-asked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-right: var(--space-4);
}

.mem-asked p {
    margin: var(--space-1) 0 0;
}

.mem-result .modal-close {
    position: absolute;
    top: 0.4rem;
    right: 0.6rem;
}

.mem-result ul {
    margin: var(--space-1) 0 var(--space-2);
    padding-left: var(--space-4);
}

.mem-result ul:last-child {
    margin-bottom: 0;
}

.mem-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    font-size: 0.86rem;
}

.mem-pager:empty {
    display: none;
}

/* One member. The window keeps its top where it is: its tabs are of very different heights, and centered in the
   screen it moved up and down with every tab, taking the tab strip from under the pointer. */
.member-modal {
    align-self: flex-start;
    margin-top: 5vh;
}

.member-modal-header {
    align-items: flex-start;
}

.member-modal-who {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.member-modal-who h2 {
    margin: 0;
    overflow-wrap: anywhere;
}

.member-modal-who p {
    margin: var(--space-0-5) 0 0;
    font-size: 0.82rem;
}

.app-avatar.app-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
}

/* The tabs sit in a band of their own, with a line under it: what scrolls below ran straight up against them */
.member-modal-tabs {
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.member-modal-tabs:has(.apps-tabs[hidden]) {
    display: none;
}

.member-modal .modal-body > h3:first-child,
.member-modal .modal-body > .sec-facts:first-child {
    margin-top: 0;
}

/* A plain line in the window (a list that is empty, how they got in) is the size of the lists around it: it took
   the window's own 16px and stood larger than everything beside it */
.member-modal .modal-body > p[class="text-muted"],
.member-modal .mem-roles > span[class="text-muted"] {
    font-size: 0.85rem;
}

/* Adding roles on a member's profile (members.js _memRolePicker): search, check several, add */
.role-picker {
    max-width: 520px;
    margin-top: var(--space-2);
}

.role-picker-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.role-picker-row > .btn {
    flex-shrink: 0;
}

/* (as tall as the button beside it: it was 42px to the button's 36, with the button nudged down to match) */
.role-picker-field {
    position: relative;
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    min-height: var(--control-height);
    padding: var(--space-1) var(--space-8) var(--space-1) var(--space-2);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: text;
    transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.role-picker-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.role-picker-chips {
    display: contents;
}

.role-picker-input {
    flex: 1;
    min-width: 120px;
    padding: var(--space-1) var(--space-2);
    background: none;
    border: 0;
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
}

.role-picker-caret {
    position: absolute;
    top: 50%;
    right: 12px;
    color: var(--text-muted);
    font-size: 0.75rem;
    transform: translateY(-50%);
    transition: transform var(--move-fast) var(--ease-out);
    pointer-events: none;
}

.role-picker.is-open .role-picker-caret {
    transform: translateY(-50%) rotate(180deg);
}

.role-picker-list {
    max-height: 240px;
    margin: var(--space-2) 0 0;
    padding: var(--space-1);
    overflow-y: auto;
    list-style: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-float);
    scrollbar-width: thin;
}

.role-picker-option {
    --role-color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-2);
    border-radius: 5px;
    color: var(--text-normal);
    font-size: 0.88rem;
    cursor: pointer;
}

.role-picker-option:hover,
.role-picker-option.is-active {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.role-picker-option.is-active {
    box-shadow: inset 2px 0 0 var(--primary);
}

.role-picker-check {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.6rem;
    color: transparent;
}

.role-picker-option[aria-selected="true"] .role-picker-check {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.role-picker-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-picker-empty {
    padding: var(--space-2);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.mem-add-none {
    margin: var(--space-2) 0 0;
    font-size: 0.85rem;
}

.member-modal .tools-inline .settings-input,
.member-modal .tools-inline .settings-select {
    width: auto;
    min-width: 200px;
}

.mem-why {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin: var(--space-2) 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.mem-why i {
    font-size: 0.72rem;
}

.mem-locked {
    margin-top: var(--space-2);
    font-size: 0.84rem;
}

.mem-locked summary {
    color: var(--text-muted);
    cursor: pointer;
}

.mem-locked ul {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-4);
}

.mem-locked li {
    margin: var(--space-1) 0;
}

.mem-note {
    margin: var(--space-2) 0 0;
    font-size: 0.82rem;
}

.mem-hours {
    height: 110px;
}

.mem-mini {
    font-size: 0.84rem;
}

.mem-ticket-end {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Members: who brought whom in (the Connections tab). Each level of the tree is indented under a line.
   (A backup's list of changes, Backups page, is laid out the same.) */
.mem-tree,
.mem-chain,
.bk-changes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.mem-tree .mem-tree {
    margin-top: var(--space-2);
    padding-left: var(--space-5);
    border-left: 1px solid var(--border-color);
}

.mem-tree-row,
.mem-joined {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-row);
    margin: 0;
    font-size: 0.85rem;
}

.mem-tree-more > summary {
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.mem-tree-note {
    margin: var(--space-1) 0 0;
    font-size: 0.8rem;
}

@media (max-width: 700px) {
    .mem-filters {
        grid-template-columns: 1fr 1fr;
    }
}

.member-modal .tools-inline {
    align-items: center;
}

/* Simple view (Preferences > Detail, the default): what only Everything shows */
:root:not([data-detail="full"]) .extra {
    display: none !important;
}

/* Module settings in folding sections (Ticket Options and other long modules) */
.module-group {
    margin: 0 0 var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-main);
}

.module-group > summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    list-style: none;
}

.module-group > summary::-webkit-details-marker {
    display: none;
}

.module-group > summary::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform var(--move-fast) var(--ease-out);
}

.module-group[open] > summary::before {
    transform: rotate(45deg);
}

.module-group > summary:hover {
    color: var(--accent);
}

.module-group-body {
    padding: var(--space-4) var(--space-4) var(--space-1);
    border-top: 1px solid var(--border-color);
}

/* "More options" on a card built into the page (the Auto-Mod filters): the last thing in its card, and in the
   Everything view laid open in place with nothing to click (appearance.js opens it) */
.settings-card-body > .module-group:last-child {
    margin-bottom: 0;
}

:root[data-detail="full"] .more-fold[open] {
    margin: 0;
    border: 0;
    background: none;
}

:root[data-detail="full"] .more-fold[open] > summary {
    display: none;
}

:root[data-detail="full"] .more-fold[open] > .module-group-body {
    padding: 0;
    border-top: 0;
}

/* On feature pages a section spans the card and lays its fields out like the form does (so does one inside
   "More options", where a long feature's settings keep their headings: modules.js renderModuleForm) */
.module-card-embedded .module-form > .module-group,
.module-card-embedded .module-group-body > .module-group {
    grid-column: 1 / -1;
}

.module-card-embedded .module-group-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 0 var(--space-5);
}

.module-card-embedded .module-group-body > .module-field-rows,
.module-card-embedded .module-group-body > .module-field-textarea,
.module-card-embedded .module-group-body > .module-field-wide,
.module-card-embedded .module-form > .module-field-wide {
    grid-column: 1 / -1;
}

.module-card-embedded .module-group-body > .module-field {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);    /* (a picker's longest choice can't widen it past its card) */
    row-gap: 0;
}

.module-card-embedded .module-group-body > .module-field > label {
    align-self: end;
}

.module-card-embedded .module-group-body > .module-field > :nth-child(2),
.module-card-embedded .module-group-body > .module-field > small {
    align-self: start;
}

.module-card-embedded .module-group-body > .module-field-bool > .module-bool-control {
    grid-row: 2;
    min-height: 44px;
}

.module-card-embedded .module-group-body > .module-field-bool > small {
    grid-row: 3;
}

.module-form input[type=time] {
    max-width: 160px;
}

/* ── Activity Log: server events ─────────────────────────────────────────────── */
.slog-intro {
    margin: var(--space-3) 0 var(--space-4);
    font-size: 0.86rem;
}

/* (and the Features page's list of features, every one on a line) */
.slog-rows,
.mod-list {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.slog-row {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.slog-row:last-child {
    border-bottom: 0;
}

.slog-row summary {
    list-style: none;
    cursor: pointer;
}

.slog-row summary::-webkit-details-marker {
    display: none;
}

.slog-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-width: 0;
}

.slog-summary {
    flex: 1;
    min-width: 0;
    color: var(--text-main);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.slog-time {
    flex-shrink: 0;
    font-size: 0.78rem;
}

.slog-chip {
    flex-shrink: 0;
    padding: var(--pad-chip);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.slog-chip.slog-messages, .slog-chip.slog-purges { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--text-main); }
.slog-chip.slog-moderation, .slog-chip.slog-security { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--text-main); }
.slog-chip.slog-server { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--text-main); }
.slog-chip.slog-members, .slog-chip.slog-roles, .slog-chip.slog-names { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--text-main); }

.slog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    font-size: 0.8rem;
}

.slog-person {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-normal);
}

.slog-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.slog-avatar-blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
}

.slog-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.84rem;
}

.slog-detail pre {
    margin: var(--space-1) 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--text-normal);
    font-family: inherit;
}

.slog-changes {
    margin: 0;
    padding-left: var(--space-4);
}

.slog-note {
    margin-top: var(--space-3);
    font-size: 0.8rem;
}

/* Pictures kept from deleted messages, and files with what VirusTotal says about them */
.slog-mark {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.slog-head .state-chip {
    flex-shrink: 0;
    align-self: center;
}

.slog-pictures {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

/* The width cap sits on the tile, not the picture: a percentage on the picture would be left out
   when the tile sizes itself, leaving a strip beside wide pictures */
.slog-picture {
    position: relative;
    display: block;
    max-width: min(100%, 320px);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.slog-picture img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 200px;
}

.slog-picture:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.slog-files {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: var(--space-1) 0 0;
    padding: 0;
    list-style: none;
}

.slog-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-row);
}

.slog-file > .fa-file {
    color: var(--text-muted);
}

.slog-file-name {
    min-width: 0;
    color: var(--text-normal);
    overflow-wrap: anywhere;
}

.tools-bar small {
    white-space: nowrap;
}

/* Role panel rules in the embed builder */
.role-panel-rules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.role-panel-rules .role-panel-required {
    grid-column: 1 / -1;
}

.role-panel-rules small {
    display: block;
    margin-top: var(--space-hint);
    font-size: 0.76rem;
}

.module-form input[type=datetime-local] {
    max-width: 240px;
}

/* ── Suggestions page ─────────────────────────────────────────────────────── */

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

.sugg-sort {
    width: auto;
}

.sugg-list {
    display: flex;
    flex-direction: column;
}

.sugg-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: var(--space-3) var(--space-4);
}

.sugg-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.sugg-number {
    font-weight: 700;
    color: var(--text-main);
}

.sugg-when {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sugg-text {
    margin: var(--space-2) 0 0;
    color: var(--text-main);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sugg-note,
.sugg-decision {
    margin: var(--space-2) 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sugg-decision strong {
    color: var(--text-main);
}

.sugg-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.sugg-votes {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.sugg-vote {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.sugg-vote-up i {
    color: var(--success-text);
}

.sugg-vote-down i {
    color: var(--danger-text);
}

.sugg-bar {
    position: relative;
    width: 90px;
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--danger) 45%, var(--bg-tertiary));
    overflow: hidden;
}

.sugg-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--success);
    border-right: 2px solid var(--bg-card);
}

.sugg-bar span[style="width:0%"] {
    border-right: 0;
}

.sugg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* On a phone the decisions take a line of their own under the votes, two to a line (beside the votes they wrapped
   as they fell, the delete button alone on a third line) */
@media (max-width: 640px) {
    .sugg-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .sugg-actions > .btn {
        flex: 1 1 40%;
        justify-content: center;
    }

    .sugg-actions > .sugg-delete {
        flex: 0 0 auto;
    }
}

/* (waiting: the chip's own quiet color; done: the accent, as a link's word is) */
.sugg-status-implemented {
    color: var(--accent);
}

/* A switch in a list entry can shrink so a long label wraps inside the entry */
.module-form .module-row > .module-field-bool {
    flex: 0 1 auto;
    min-width: 0;
}

/* ── Welcome messages (Welcome & Leave page) ──────────────────────────────── */

/* Above the messages: what they are, and the ready-made ones to add */
.wm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-inner);
    padding-top: var(--space-field);
    border-top: 1px solid var(--border-color);
}

.wm-toolbar h4,
.wm-toolbar p,
.wm-head h5 {
    margin: 0;
}

.wm-toolbar h4,
.wm-head h5 {
    font-size: 0.95rem;
    font-weight: 600;
}

.wm-toolbar p {
    font-size: 0.85rem;
}

/* A card that only some people may change: its fields are a fieldset, disabled for them */
.wm-editable {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.wm-ready,
.wm-own-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.wm-ready {
    gap: var(--space-2);
}

/* One message: its settings beside what members will see */
.wm-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.wm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.wm-head h5 {
    flex: 1;
    min-width: 0;
}

/* One of several things edited on a page (a welcome message, a ticket type) is a row that opens to its
   editor: its name and, while it is closed, a line saying what is in it. The same arrow as the rows of settings.
   So a page with five of them is five lines, not five editors. */
.row-open {
    display: flex;
    flex-wrap: wrap;            /* (on a phone the kind goes under the name) */
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-width: 0;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.row-open::before {
    content: '';
    flex: none;
    width: 0.4rem;
    height: 0.4rem;
    margin-right: var(--space-1);
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform var(--move-fast) var(--ease-out);
}

.row-open[aria-expanded="true"]::before {
    transform: rotate(45deg);
}

.row-open > span {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 1.25rem);    /* (beside the arrow: a long name, "Повідомлення 1", takes two lines on a
                                           phone rather than leave its row) */
    overflow-wrap: anywhere;
    hyphens: auto;
}

.row-open > .row-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-open[aria-expanded="true"] > .row-summary {
    visibility: hidden;         /* the editor below says it */
}

.row-open:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.wm-item:has(> .wm-body[hidden]) > .wm-head {
    border-bottom: 0;
}

.tp-type > .module-card-head h3 {
    flex: 1;
    min-width: 0;
}

.wm-kind {
    padding: var(--pad-chip);
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.wm-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-5);
    padding: var(--space-4);
}

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

/* The { } codes a text can use, each a chip that adds it where the person is typing (core.js codeChip): in a row
   of their own under a message, with what each becomes, or in the hint under a box that names them */
.code-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.code-chips > span {
    flex-basis: 100%;
}

/* (under a setting's help: Stat Counters' codes) */
.module-field small > .code-chips {
    margin-top: var(--space-2);
}

/* (under a welcome or goodbye message's text, close to the box they add to) */
.wm-fields > .code-chips {
    margin: calc(-1 * var(--space-2)) 0 var(--space-4);
}

.code-chip {
    min-height: 24px;
    padding: var(--pad-chip);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: none;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
}

/* (in a line of words: clear of the lines above and below when the hint wraps) */
:is(small, p) > .code-chip {
    margin: var(--space-0-5) 0;
}

.code-chip code {
    color: var(--text-main);
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

.code-chip:hover,
.code-chip:focus-visible {
    border-color: var(--accent);
    color: var(--text-normal);
}

/* An embed's two pictures side by side: what goes there, and its link */
.wm-pairs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-4);
}

.wm-pair > .form-group:last-child {
    margin-top: calc(-1 * var(--space-2));
}

/* The picture card's settings, set apart under their own small heading */
.wm-card-opts {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4) var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.wm-card-opts h6 {
    margin: 0 0 var(--space-3);
    font-size: 0.85rem;
    font-weight: 600;
}

.wm-own {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.wm-own > .form-group {
    align-self: stretch;
    margin-bottom: 0;
}

.wm-own-actions {
    gap: var(--space-3);
}

.wm-own-pic {
    width: 100%;
    max-width: 320px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.wm-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* The picture card in the preview: under the text (where what hangs under a message has its own gap), or as the
   embed's big picture */
.wm-pv-cardbox {
    margin: var(--space-2) 0 0;
}

.discord-under > .wm-pv-cardbox {
    margin-top: 0;
}

.wm-pv-cardbox.is-busy img {
    opacity: 0.6;
}

.wm-pv-card {
    display: block;
    width: 100%;
    max-width: 520px;
    border-radius: 6px;
}

/* A picture the preview doesn't have: an avatar or icon it wasn't given, or a link the dashboard is still fetching
   (core.js discordMessage) */
.wm-pv-blank,
.picture-pending {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1);
    background: rgba(255, 255, 255, 0.06);
    color: #b5bac1;
    font-size: 0.7rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.picture-pending.discord-embed-image {
    width: 100%;
    max-width: 400px;
    height: 120px;
}

/* Under a preview, a picture link Discord won't show, and why */
.picture-notes {
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
    color: var(--warning-text);
    font-size: 0.8rem;
}

.picture-notes li + li {
    margin-top: var(--space-1);
}

/* Beside a long message, what members see stays in view */
.wm-preview {
    position: sticky;
    top: var(--space-4);
}

.wm-preview .discord-message-container {
    max-width: none;
}

/* The embed narrows with a narrow screen instead of running past its message */
.wm-preview .discord-embed {
    min-width: 0;
}

/* A mention as Discord draws it */
.discord-mention {
    padding: 0 var(--space-0-5);
    border-radius: 3px;
    background: rgba(88, 101, 242, 0.3);
    color: #c9cdfb;
    font-weight: 500;
}

/* On a narrow screen the preview comes first, the settings under it */
@media (max-width: 1100px) {
    .wm-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .wm-preview {
        position: static;
        order: -1;
    }

    .wm-pairs {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* A textarea with ready-made texts to pick from (modules.js, a field's presets) */
.preset-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
}

.preset-field textarea {
    align-self: stretch;
}

.preset-field select {
    width: auto;
    max-width: 100%;
}

/* ── Welcome card options ─────────────────────────────────────────────────── */

.wm-fields .form-group {
    margin-bottom: var(--space-4);
}

/* ── Transcripts page ─────────────────────────────────────────────────────── */

.tx-days {
    width: auto;
}

.tx-name {
    display: flex;
    flex-direction: column;
}

.tx-more {
    margin-top: var(--space-3);
}

.tx-modal {
    width: min(1100px, 94vw);
    max-width: none;
    height: min(88vh, 1000px);
    display: flex;
    flex-direction: column;
}

.tx-modal .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.tx-modal .modal-header h2 {
    margin: 0;
}

.tx-modal .modal-header p {
    margin: var(--space-1) 0 0;
}

.tx-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: none;
}

.tx-frame {
    flex: 1;
    width: 100%;
    border: 0;
    border-radius: 0 0 10px 10px;
    background: #36393f;
}

.tx-actions a.btn {
    text-decoration: none;
}

/* ══ Page layout ═══════════════════════════════════════════════════════════════
   Pages built from the same pieces look alike: sections and cards sit one
   --space-page apart, boxes inside a card one --space-inner apart, form fields one
   --space-field apart, and cards, tiles and headers share the same padding (the
   tokens are in tokens.css, where compact density shrinks them all together). Page
   markup uses the classes below instead of inline spacing. */

/* A card on its own keeps a gap below it; inside a stack or grid (below) the gap does it */
.settings-card {
    margin-bottom: var(--space-page);
}

/* A page is a stack of sections one gap apart; the gap does the spacing, so the
   sections' own top and bottom margins are dropped. Opening, it fades in (Preferences > Opening a page can
   make it come up a short way as well, or be there at once: further down, with the other choices) */
.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: var(--space-page);
    transition: opacity var(--motion-base) var(--ease-out), translate var(--move-base) var(--ease-out);
}

.tab-content.active > * {
    margin-top: 0;
    margin-bottom: 0;
}

/* Segmented tabs keep their own width instead of stretching across the page */
.tab-content.active > .apps-tabs,
.tab-content.active > .apps-filters,
.stack-page > .apps-tabs,
.stack-page > .apps-filters {
    align-self: flex-start;
}

/* A heading sits closer to what it introduces than to the section before it */
.tab-content.active > .section-heading {
    margin-bottom: calc(var(--space-inner) - var(--space-page));
}

.section-title {
    margin-bottom: var(--space-page);
}

h2.section-heading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* A new part of a long page: a line, then its heading */
.section-break {
    padding-top: var(--space-page);
    border-top: 1px solid var(--border-color);
}

.page-rule {
    border: 0;
    border-top: 1px solid var(--border-color);
}

.page-rule {
    margin: var(--space-page) 0;
}

/* ── Stacks and grids of cards ───────────────────────────────────────────── */
.settings-container,
.module-mount,
.embed-builder-layout,
.sec-main,
.sec-side,
.sec-trends,
.overview-grid,
.overview-side,
.sec-status,
.sec-layout,
.tools-body,
.stack-page,
.page-grid {
    gap: var(--space-page);
}

.module-mount,
.stack,
.stack-page {
    display: flex;
    flex-direction: column;
}

.stack {
    gap: var(--space-inner);
}

.settings-container > *,
.module-mount > *,
.page-grid > *,
.stack > *,
.stack-page > *,
.tools-body > *,
.tools-grid > * {
    margin-top: 0;
    margin-bottom: 0;
}

.page-grid {
    display: grid;
}

.page-grid.align-start {
    align-items: start;
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* Cards side by side while each has room for a table of four columns (about 20rem): as many columns as
   fit, where three fixed columns would squeeze a table until its last column is cut off on a mid-width
   screen. A card left over on the last row keeps a column's width. */
.page-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
    gap: var(--space-page);
}

.page-row > * {
    min-width: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Four cards showing (Analytics > Staff in the Everything view, with each feature on) are two rows of two: as
   three and one, the fourth stood alone in a row beside two empty columns. A card whose feature is off isn't
   counted, and in a narrow window they are still one column. */
html[data-detail="full"] .page-row:has(> :nth-child(4 of :not(.feature-off))):not(:has(> :nth-child(5 of :not(.feature-off)))) {
    grid-template-columns: repeat(auto-fit, minmax(max(min(20rem, 100%), calc(50% - var(--space-page))), 1fr));
}

/* Fields side by side inside a card */
.field-grid {
    display: grid;
    column-gap: var(--space-5);
    row-gap: var(--space-field);
    align-items: start;
}

.field-grid > .form-group {
    margin: 0;
}

/* Small boxes side by side inside a card */
.tile-grid {
    display: grid;
    gap: var(--space-inner);
}

.field-grid:not(:last-child),
.tile-grid:not(:last-child) {
    margin-bottom: var(--space-field);
}

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

}

/* ── Cards and tiles ─────────────────────────────────────────────────────── */
.settings-card-header {
    padding: var(--pad-head);
}

.settings-card-body {
    padding: var(--pad-body);
}

.module-card-embedded {
    padding: var(--pad-head);
}

.module-card:not(.module-card-embedded) {
    padding: var(--pad-tile);
}

/* Boxes inside a card */
.module-rows,
.embed-editor-col,
.sugg-list {
    gap: var(--space-inner);
}

.embed-editor-col > * {
    margin-top: 0;
    margin-bottom: 0;
}

.apps-toolbar,
.mem-filters,
.slog-filters {
    margin-bottom: var(--space-inner);
}

/* The Modules page: categories one gap apart, the title close to its cards */
.module-category {
    margin-bottom: var(--space-page);
}

.module-category-title {
    margin: 0 0 var(--space-inner);
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.settings-card-body > .form-group,
.form-grid-2 > .form-group,
.module-group-body > .form-group,
.module-card-embedded .module-form > .module-field,
.module-card-embedded .module-group-body > .module-field {
    margin-bottom: var(--space-field);
}

.settings-card-body > .form-group:last-child {
    margin-bottom: 0;
}

/* Fields carry the space between rows, so a grid of them adds none of its own,
   and the last grid in a card doesn't leave extra room at the bottom */
.settings-card-body > .form-grid-2:not(:last-child) {
    margin-bottom: 0;
}

.settings-card-body > .form-grid-2:last-child {
    margin-bottom: calc(-1 * var(--space-field));
}

/* Module settings on a feature's page: at most three fields per row, so short
   rows don't leave most of a wide card empty */
.module-card-embedded .module-form,
.module-card-embedded .module-group-body {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(240px, calc((100% - 2.5rem) / 3))), 1fr));
}

.section-title-row.is-centered {
    align-items: center;
}

/* An editor's bar (Back, its name, Save) stays at the top while the editor scrolls (Ticketing, Applications, Forms,
   Commands), and a preview beside the editor stops below it */
.section-title-row.is-pinned {
    position: sticky;
    top: 0;
    z-index: 6;
    padding: var(--space-3) 0;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.section-title-row.is-pinned ~ .embed-builder-layout .embed-preview-col {
    top: calc(var(--control-height) + 2 * var(--space-3) + var(--space-4));
}

/* On a phone the bar keeps Back and Save on one line, at its two ends, and the name goes under them (Save wrapped
   onto a line of its own, at the left, with the name pushed to the far right of Back) */
@media (max-width: 640px) {
    .section-title-row.is-pinned {
        align-items: center;
    }

    .section-title-row.is-pinned > h2 {
        order: 1;
        flex: 1 0 100%;
        text-align: center;
    }
}

.modules-search {
    width: 260px;
    max-width: 100%;
}

/* Commands page: the bot's commands in the Features layout (custom-commands.js) */
.botcmd-group + .botcmd-group {
    margin-top: var(--space-page);
}

.botcmd-name {
    display: inline-flex;
    align-items: center;
    gap: var(--gap-row);
    white-space: nowrap;
}

.botcmd-name code {
    color: var(--accent);
    font-weight: 600;
}

.botcmd-table td:nth-child(2) {
    width: 100%;
}

/* Every group's table gives the command the same room, so "What it does" starts at the same place in each
   (left to its content, each table put it somewhere else) */
.botcmd-table :is(th, td):first-child {
    min-width: 13rem;
}

@media (max-width: 640px) {
    .botcmd-table :is(th, td):first-child {
        min-width: 0;
    }
}

/* A notice that is a page section by itself: the page gap spaces it */
.tab-content.active > * > .global-notice:only-child {
    margin: 0;
}

/* Fields stacked in an editor's accordion: one field gap apart, like everywhere else */
.accordion-content > * + .form-group {
    margin-top: var(--space-field);
}

/* A line about the section, above its fields */
.accordion-content > p {
    margin: 0 0 var(--space-field);
    font-size: 0.85rem;
}

/* Role reactions and buttons (Embeds & Roles): the column is narrow, so the small fields stay small and the
   roles take the room that is left, with Remove on the same line */
#role-rows .module-row {
    display: flex;              /* (a line that shares its width unevenly, where a list's rows are columns) */
    flex-wrap: wrap;
    align-items: flex-start;
}

#role-rows .module-row > .module-field {
    flex: 1 1 140px;
}

#role-rows .module-row > [data-key="role_ids"] {
    flex: 3 1 200px;
}

/* ── Theme pictures, glass cards, corners and fonts ──────────────────────────
   Set by server themes (appearance.js applyThemeDecor): data attributes on <html>
   pick the look, and custom properties carry the numbers and picture addresses
   (only ever /theme-assets/<id>.webp, served by the dashboard itself). With
   animation turned down, in Preferences or on the device, animated pictures show
   their still first frame. */
:root {
    --bg-main-rgb: 20, 23, 28;
    --bg-card-rgb: 27, 31, 37;
    --bg-darker-rgb: 15, 17, 21;
    --bg-dim: 0.45;
    --bg-blur: 0px;
    --side-dim: 0.6;
    --card-opacity: 0.85;
    --card-blur: 12px;
    --bg-picture: var(--bg-image);
    --side-picture: var(--side-image);
}

[data-motion="reduced"] {
    --bg-picture: var(--bg-image-still);
    --side-picture: var(--side-image-still);
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="on"]) {
        --bg-picture: var(--bg-image-still);
        --side-picture: var(--side-image-still);
    }
}

html[data-font="rounded"] { --font-ui: 'Nunito', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html[data-font="geometric"] { --font-ui: 'Poppins', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html[data-font="serif"] { --font-ui: 'Source Serif 4', Georgia, 'Times New Roman', serif; }
html[data-font="mono"] { --font-ui: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace; }

/* The page picture: a fixed layer behind everything, dimmed with the page color.
   It reaches past the screen edges by the blur, so blurring never softens them. */
html[data-bg="picture"] body::before {
    content: "";
    position: fixed;
    inset: calc(var(--bg-blur) * -3);
    z-index: -1;
    pointer-events: none;
    background-color: rgb(var(--bg-main-rgb));
    background-image:
        linear-gradient(rgba(var(--bg-main-rgb), var(--bg-dim)), rgba(var(--bg-main-rgb), var(--bg-dim))),
        var(--bg-picture);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(var(--bg-blur));
}

html[data-bg-fit="contain"] body::before { background-size: contain; }
html[data-bg-fit="tile"] body::before { background-size: auto; background-repeat: repeat; }
html[data-bg-pos="top"] body::before { background-position: center top; }
html[data-bg-pos="bottom"] body::before { background-position: center bottom; }

html[data-bg="picture"] .main-content {
    background-color: transparent;
}

/* Over a page picture the top bar and menu are tinted glass */
html[data-bg="picture"] :is(.top-nav, .sidebar, .site-footer) {
    background-color: rgba(var(--bg-darker-rgb), 0.78);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
}

html[data-bg="picture"] .section-title-row.is-pinned {
    background: rgba(var(--bg-main-rgb), 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* The sidebar's own picture, dimmed with the sidebar color; it stays put while the menu scrolls */
html[data-side-bg="picture"] .sidebar {
    background-color: rgb(var(--bg-darker-rgb));
    background-image:
        linear-gradient(rgba(var(--bg-darker-rgb), var(--side-dim)), rgba(var(--bg-darker-rgb), var(--side-dim))),
        var(--side-picture);
    background-position: center;
    background-size: cover;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* Glass cards: see-through, frosting what is behind them. Only inside the page area;
   menus, dialogs and notices elsewhere stay solid. */
html[data-surface="glass"] .main-content {
    --bg-card: rgba(var(--bg-card-rgb), var(--card-opacity));
}

html[data-surface="glass"] .main-content :is(.settings-card,
    .module-card, .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat, .sec-protections,
    .data-table-wrap, .tools-summary, .sugg-card, .mem-result, .slog-rows,
    .no-server-notice) {
    -webkit-backdrop-filter: blur(var(--card-blur));
    backdrop-filter: blur(var(--card-blur));
}

/* Frosting makes each card a layer of its own; the card being used comes forward so a
   list opening from it isn't covered by the next card */
html[data-surface="glass"] .main-content :is(.settings-card,
    .module-card, .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat, .sec-protections,
    .data-table-wrap, .tools-summary, .sugg-card, .mem-result, .slog-rows,
    .no-server-notice):focus-within {
    position: relative;
    z-index: 4;
}

/* Lists that open over other content stay solid */
html[data-surface="glass"] .main-content :is(.choices__list--dropdown, .choices__list[aria-expanded],
    .apps-export-menu) {
    background-color: rgb(var(--bg-card-rgb));
}

/* Corners */
html[data-radius="sharp"] :is(.settings-card, .module-card,
    .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat, .sec-protections,
    .data-table-wrap, .tools-summary, .sugg-card, .mem-result, .slog-rows,
    .no-server-notice, .global-notice, .accordion-item, .modal-content, .toast,
    .server-menu, .account-menu, .apps-export-menu, .picture-tile, .perm-role, .perm-role-head, .perm-level-tile,
    .perm-section, .cmd-perm-list) {
    border-radius: 3px;
}

html[data-radius="sharp"] :is(.btn, .settings-input, .settings-select, .segmented, .segmented button,
    .server-switcher-btn, .account-btn, .theme-swatches, .theme-thumb, .perm-level-btn, .perm-level-chip,
    .cmd-perm-toggle),
html[data-radius="sharp"] .choices .choices__inner {
    border-radius: 2px;
}

html[data-radius="sharp"] :is(.choices__list--dropdown, .choices__list[aria-expanded]) {
    border-radius: 0 0 2px 2px;
}

html[data-radius="round"] :is(.settings-card, .module-card,
    .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat, .sec-protections,
    .data-table-wrap, .tools-summary, .sugg-card, .mem-result, .slog-rows,
    .no-server-notice, .global-notice, .modal-content, .server-menu, .account-menu,
    .apps-export-menu, .perm-role, .perm-role-head) {
    border-radius: 18px;
}

html[data-radius="round"] :is(.accordion-item, .toast, .picture-tile, .perm-level-tile, .perm-section, .cmd-perm-list) {
    border-radius: 14px;
}

html[data-radius="round"] :is(.perm-level-btn, .perm-level-chip, .cmd-perm-toggle) {
    border-radius: 999px;
}

html[data-radius="round"] :is(.settings-input, .settings-select, .theme-swatches, .theme-thumb),
html[data-radius="round"] .choices .choices__inner {
    border-radius: 12px;
}

html[data-radius="round"] :is(.btn, .segmented, .segmented button, .server-switcher-btn, .account-btn) {
    border-radius: 999px;
}

html[data-radius="round"] :is(.choices__list--dropdown, .choices__list[aria-expanded]) {
    border-radius: 0 0 12px 12px;
}

html[data-radius="round"] .is-flipped :is(.choices__list--dropdown, .choices__list[aria-expanded]) {
    border-radius: 12px 12px 0 0;
}

/* ── Theme tiles and the theme editor ───────────────────────────────────── */
.theme-tile-pick > .theme-swatches,
.theme-thumb {
    height: 34px;
}

/* A theme with a picture: its still frame, with the colors along the bottom */
.theme-thumb {
    display: flex;
    align-items: flex-end;
    padding: var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    background-position: center;
    background-size: cover;
}

.theme-thumb .theme-swatches {
    flex: 1;
    height: 10px;
    border-radius: 4px;
    border-color: rgba(255, 255, 255, 0.35);
}

.theme-editor-section {
    margin-top: var(--space-field);
    padding-top: var(--space-field);
    border-top: 1px solid var(--border-color);
}

.theme-editor-heading {
    margin: 0 0 var(--space-1);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.theme-editor-hint {
    margin: 0 0 var(--space-inner);
    max-width: 720px;
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--text-muted);
}

/* (fields start level, so the labels in a row line up: bottoms level put a field without a hint lower than
   its neighbor with one) */
.theme-editor-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: var(--space-field) var(--space-5);
    align-items: start;
    margin-top: var(--space-field);
}

.theme-editor-fields > .form-group {
    margin: 0;
}

.theme-editor-fields .segmented {
    align-self: flex-start;
}

/* Styled like the other field labels */
.theme-field-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-group > .theme-range-label {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
}

.theme-range-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-normal);
}

.theme-range {
    width: 100%;
    height: 34px;
    accent-color: var(--primary);
    cursor: pointer;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(118px, 100%), 1fr));
    gap: var(--space-inner);
}

.picture-tile {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.picture-tile:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
}

.picture-tile.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.picture-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    width: 100%;
    height: 100%;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.picture-pick:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.picture-pick img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.picture-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: var(--pad-chip);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    border-radius: 4px;
}

/* A check mark on the chosen picture, so the choice doesn't rely on the border color alone */
.picture-tile.is-selected .picture-pick::after {
    content: "\f00c";
    position: absolute;
    top: 6px;
    left: 6px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
}

.picture-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out);
}

.picture-tile:hover .picture-delete,
.picture-delete:focus-visible {
    opacity: 1;
}

.picture-delete:hover {
    background: var(--danger);
}

.picture-delete:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

@media (hover: none) {
    .picture-delete {
        opacity: 1;
    }
}

.picture-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-inner);
    font-size: 0.8rem;
}

/* ── Menu position and your pages (Preferences > Layout) ─────────────────────
   The same menu on the left (default), right, top or bottom. Along the top or
   bottom with names shown, each group opens as a small menu (core.js
   toggleNavMenu); with icons only, every page is one icon in a row, like a dock.
   Pinned pages sit in their own list at the start (appearance.js _arrangeNav) and
   hidden pages leave the menu. */
.nav li.is-hidden-by-you {
    display: none !important;
}

/* A hover that shows on light themes as well as dark ones */
.nav li:hover {
    background-color: color-mix(in srgb, var(--text-main) 5%, transparent);
}

.nav-pinned {
    margin-bottom: var(--space-5);
}

.nav-pinned-label {
    display: block;
    margin: var(--space-1) 0 var(--space-1);
    padding: 0 var(--space-2);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dark);
}

[data-density="compact"] .nav-pinned { margin-bottom: var(--space-3); }
[data-sidebar="icons"] .nav-pinned-label { display: none; }
[data-sidebar="icons"] .nav-pinned { margin-bottom: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }

/* Right */
html[data-nav-position="right"] .layout-wrapper { flex-direction: row-reverse; }
html[data-nav-position="right"] .sidebar { border-right: 0; border-left: 1px solid var(--border-color); }
html[data-nav-position="right"] .nav li.active { box-shadow: inset -3px 0 0 var(--primary); }

/* Top and bottom: a bar across the window */
html[data-nav-position="top"] .layout-wrapper { flex-direction: column; }
html[data-nav-position="bottom"] .layout-wrapper { flex-direction: column-reverse; }

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .main-content {
    min-height: 0;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .sidebar {
    position: relative;
    z-index: 50;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
}

html[data-nav-position="bottom"] .sidebar {
    border-bottom: 0;
    border-top: 1px solid var(--border-color);
}

/* Along the bottom, the menu is inside the scrolling area, just before the footer (core.js moves it there): it
   stays at the bottom of the window while the page scrolls, and the footer comes in under it at the page's end.
   The room a page keeps at its end is above the menu, so none of it is left between the menu and the footer. */
html[data-nav-position="bottom"] .main-content > .sidebar {
    position: sticky;
    bottom: 0;
    margin-top: calc(var(--room-page-end) / 2);
}

html[data-nav-position="bottom"] .main-content > .sidebar + .site-footer {
    margin-top: 0;
}

/* What is scrolled into view (a field reached with Tab) stops above the menu, which lies over the area's end */
html[data-nav-position="bottom"] .main-content {
    scroll-padding-bottom: var(--nav-bar-h);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .sidebar :is(.top-level-nav, .nav-pinned, .sidebar-category) {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .sidebar :is(.top-level-nav, .pinned-nav) {
    display: flex;
    flex-wrap: wrap;        /* on a narrow phone its pages take a second line instead of running past the edge */
    max-width: 100%;
    gap: var(--space-0-5);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .sidebar .nav li {
    margin: 0;
    white-space: nowrap;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]) .nav-pinned-label {
    display: none;
}

/* The current page is marked on the edge facing the page */
html[data-nav-position="top"] .sidebar :is(.top-level-nav, .pinned-nav) li.active,
html[data-nav-position="top"][data-sidebar="icons"] .sidebar .nav li.active {
    box-shadow: inset 0 -2px 0 var(--primary);
}

html[data-nav-position="bottom"] .sidebar :is(.top-level-nav, .pinned-nav) li.active,
html[data-nav-position="bottom"][data-sidebar="icons"] .sidebar .nav li.active {
    box-shadow: inset 0 2px 0 var(--primary);
}

/* With names: main pages, pinned pages, then a button per group that opens its menu */
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar :is(.top-level-nav, .nav-pinned) {
    margin-right: var(--space-0-5);
    padding-right: var(--space-2);
    border-right: 1px solid var(--border-color);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category {
    position: relative;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-header {
    width: auto;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-2) var(--space-2);
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    color: var(--text-muted);
}

[data-density="compact"]:is([data-nav-position="top"], [data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-header {
    padding: var(--space-2) var(--space-2);
}

/* In a window narrower than 1280px the row wrapped, leaving a group or two alone on a second line (at 1100px,
   the owner's usual width, "Messages" and "Server" did): the four plain entries drop their icons and every entry
   sits closer, so the row holds down to about 1030px */
@media (max-width: 1280px) {
    :is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar :is(.top-level-nav, .pinned-nav) li > i {
        display: none;
    }

    :is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar :is(.nav li, .category-header) {
        padding-left: var(--space-1);
        padding-right: var(--space-1);
    }
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-header:hover,
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category.is-open .category-header {
    background-color: color-mix(in srgb, var(--text-main) 5%, transparent);
    color: var(--text-normal);
}

/* The group holding the current page */
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category:has(li.active) .category-header {
    font-weight: 600;
    color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--primary);
}

html[data-nav-position="bottom"]:not([data-sidebar="icons"]) .sidebar .sidebar-category:has(li.active) .category-header {
    box-shadow: inset 0 2px 0 var(--primary);
}

/* Along the top or bottom the current entry isn't set in a heavier weight: heavier letters are wider, so every
   entry to its right moved a pixel or two on each change of page. A hairline of stroke gives it the same
   weight to the eye in the same width. (Down the side, and in a group's own menu, each entry has a line to
   itself and stays bold.) */
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar :is(.top-level-nav, .pinned-nav) li.active,
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category:has(li.active) .category-header {
    font-weight: 500;
    -webkit-text-stroke: 0.3px currentColor;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar :is(.top-level-nav, .pinned-nav) li.active > i,
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category:has(li.active) .category-header > i {
    -webkit-text-stroke: 0;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-header i {
    font-size: 0.62rem;
    transition: transform var(--move-fast) var(--ease-out);
}

/* The arrow points the way the menu opens, whether or not the group was folded in the sidebar */
html[data-nav-position="top"]:not([data-sidebar="icons"]) .sidebar .category-header i::before { content: "\f078"; }
html[data-nav-position="bottom"]:not([data-sidebar="icons"]) .sidebar .category-header i::before { content: "\f077"; }

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category.is-open .category-header i {
    transform: rotate(180deg);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-nav {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    min-width: 230px;
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-float);
    opacity: 0;
    translate: 0 calc(var(--move-near) * -1);
    transition: opacity var(--motion-fast) var(--ease-out), translate var(--move-fast) var(--ease-out),
                display var(--motion-fast) allow-discrete;
}

html[data-nav-position="bottom"]:not([data-sidebar="icons"]) .sidebar .category-nav {
    top: auto;
    bottom: calc(100% + 6px);
    translate: 0 var(--move-near);
}

/* Menus open on hover (core.js): an invisible strip over the gap between a group's name and its
   menu, so moving the pointer down to the menu never counts as leaving it */
:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-nav::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
}

html[data-nav-position="bottom"]:not([data-sidebar="icons"]) .sidebar .category-nav::before {
    top: auto;
    bottom: -8px;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .category-nav.opens-left {
    left: auto;
    right: 0;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"]):not([data-sidebar="icons"]) .sidebar .sidebar-category.is-open .category-nav {
    display: block;
    opacity: 1;
    translate: none;
}

@starting-style {
    html[data-nav-position="top"]:not([data-sidebar="icons"]) .sidebar .sidebar-category.is-open .category-nav {
        opacity: 0;
        translate: 0 calc(var(--move-near) * -1);
    }

    html[data-nav-position="bottom"]:not([data-sidebar="icons"]) .sidebar .sidebar-category.is-open .category-nav {
        opacity: 0;
        translate: 0 var(--move-near);
    }
}

html[data-radius="round"]:is([data-nav-position="top"], [data-nav-position="bottom"]) .sidebar .category-nav { border-radius: 16px; }
html[data-radius="sharp"]:is([data-nav-position="top"], [data-nav-position="bottom"]) .sidebar .category-nav { border-radius: 3px; }

/* Icons only: one row of icons with a line between groups, centered when there's room
   and scrolling sideways when there isn't (point at an icon for its name) */
:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar {
    flex-wrap: nowrap;
    gap: 0;
    padding: var(--space-1) var(--space-3);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar::before,
:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar::after {
    content: "";
    flex: 1 0 0;
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar :is(.nav-pinned, .sidebar-category) {
    padding: 0 0 0 var(--space-2);
    margin-left: var(--space-2);
    border-left: 1px solid var(--border-color);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar .sidebar-category .category-nav {
    display: flex;
    gap: var(--space-0-5);
}

:is(html[data-nav-position="top"], html[data-nav-position="bottom"])[data-sidebar="icons"] .sidebar .nav li {
    padding: var(--space-2) var(--space-3);
}

/* ── Layout options ─────────────────────────────────────────────────────── */
.layout-groups {
    display: flex;
    flex-direction: column;
    gap: var(--space-page);
}

.layout-group-title {
    margin: 0 0 var(--space-inner);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.layout-option-text {
    flex: 1 1 280px;
}

.layout-option-hint {
    max-width: 600px;
    line-height: 1.45;
    color: var(--text-muted);
}

.layout-option-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.82rem;
}

/* A little box showing which edge the menu sits on */
.nav-glyph {
    display: inline-block;
    width: 16px;
    height: 12px;
    margin-right: var(--space-2);
    vertical-align: -1px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    opacity: 0.85;
}

.nav-glyph-left { border-left-width: 5px; }
.nav-glyph-right { border-right-width: 5px; }
.nav-glyph-top { border-top-width: 5px; }
.nav-glyph-bottom { border-bottom-width: 5px; }

/* Quick start drawings for the top bar and the dock */
.layout-mini-topbar {
    flex-direction: column;
}

.layout-mini-topbar .layout-mini-side {
    flex-shrink: 0;
    width: 100%;
    height: 9px;
}

.layout-mini-dock {
    flex-direction: column-reverse;
    align-items: center;
}

.layout-mini-dock .layout-mini-side {
    flex-shrink: 0;
    width: 46%;
    height: 8px;
}

.layout-mini-dock .layout-mini-main {
    align-self: stretch;
}

/* Your pages: pin or hide each page of the menu */
.menu-pages {
    flex-basis: 100%;
    margin-top: var(--space-1);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border-color);
}

.menu-pages-note {
    margin: 0 0 var(--space-4);
    max-width: 720px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.menu-pages-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    gap: var(--space-4) var(--space-6);
}

.menu-pages-title {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-2);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.menu-page {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: 6px;
}

.menu-page:hover {
    background: color-mix(in srgb, var(--text-main) 4%, transparent);
}

.menu-page-icon {
    width: 18px;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-muted);
}

.menu-page-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 0.86rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-normal);
}

.menu-page.is-hidden :is(.menu-page-icon, .menu-page-name) {
    opacity: 0.45;
}

.menu-page-pin {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-dark);
    cursor: pointer;
}

.menu-page-pin i {
    transform: rotate(45deg);
    transition: transform var(--move-fast) var(--ease-out);
}

.menu-page-pin.is-on {
    color: var(--accent);
}

.menu-page-pin.is-on i {
    transform: none;
}

.menu-page-pin:hover:not(:disabled) {
    color: var(--text-normal);
    background: color-mix(in srgb, var(--text-main) 8%, transparent);
}

.menu-page-pin.is-on:hover:not(:disabled) {
    color: var(--accent);
}

.menu-page-pin:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.menu-page-pin:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

html[data-font="readable"] { --font-ui: 'Atkinson Hyperlegible', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }

/* ── Theme animation (theme editor: Page background and Animation) ───────────
   The page picture can drift, zoom, float or shift color and follow the scroll a
   little; an effect (snow, rain, stars, bubbles) can move over the page behind the
   cards; cards can appear one after another and react when pointed at. It all
   moves with transform and opacity, which browsers animate cheaply, and it all
   stops for people who turn animation down (Preferences, or their device). */

/* Picture motion: the picture is drawn a little larger than the window while it
   moves, so no edge ever shows */
@keyframes eq-bg-drift {
    0%, 100% { transform: scale(1.18) translate(-5%, -3%); }
    50% { transform: scale(1.18) translate(5%, 3%); }
}

@keyframes eq-bg-zoom {
    0%, 100% { transform: scale(1.04); }
    50% { transform: scale(1.22); }
}

@keyframes eq-bg-float {
    0%, 100% { transform: scale(1.12) translateY(-4%); }
    50% { transform: scale(1.12) translateY(4%); }
}

@keyframes eq-bg-hue {
    from { filter: blur(var(--bg-blur)) hue-rotate(0deg); }
    to { filter: blur(var(--bg-blur)) hue-rotate(360deg); }
}

html[data-bg="picture"][data-bg-motion="drift"] body::before { animation: eq-bg-drift var(--bg-motion-time, 32s) ease-in-out infinite; }
html[data-bg="picture"][data-bg-motion="zoom"] body::before { animation: eq-bg-zoom var(--bg-motion-time, 32s) ease-in-out infinite; }
html[data-bg="picture"][data-bg-motion="float"] body::before { animation: eq-bg-float var(--bg-motion-time, 32s) ease-in-out infinite; }
html[data-bg="picture"][data-bg-motion="hue"] body::before { animation: eq-bg-hue var(--bg-motion-time, 45s) linear infinite; }

/* Parallax: appearance.js sets --bg-shift (up to 110px) from how far the page is scrolled, once
   per frame while scrolling, so no transition is needed (one on translate never runs while the
   picture's motion animation does) */
html[data-bg="picture"][data-parallax="on"] body::before {
    bottom: calc(var(--bg-blur) * -3 - 120px);
    translate: 0 calc(var(--bg-shift, 0px) * -1);
}

/* Effects: one layer over the page background and behind everything else, taller
   or wider than the window by exactly one repeat of its pattern, so it can move
   by that much and start again without a jump */
html[data-effect] .main-content {
    background-color: transparent;
}

html[data-effect] body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

@keyframes eq-fx-fall { to { transform: translateY(640px); } }
@keyframes eq-fx-rise { to { transform: translateY(-640px); } }
@keyframes eq-fx-drift { to { transform: translateX(360px); } }
@keyframes eq-fx-sway {
    0%, 100% { translate: -12px 0; }
    50% { translate: 12px 0; }
}
@keyframes eq-fx-twinkle {
    from { opacity: 0.35; }
    to { opacity: 1; }
}

html[data-effect="snow"] body::after {
    top: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(circle at 60px 100px, rgba(255, 255, 255, 0.9) 0 2.6px, transparent 3.6px),
        radial-gradient(circle at 200px 420px, rgba(255, 255, 255, 0.85) 0 2.2px, transparent 3.2px),
        radial-gradient(circle at 120px 60px, rgba(255, 255, 255, 0.8) 0 1.8px, transparent 2.8px),
        radial-gradient(circle at 30px 230px, rgba(255, 255, 255, 0.75) 0 1.8px, transparent 2.8px),
        radial-gradient(circle at 90px 40px, rgba(255, 255, 255, 0.6) 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 150px 120px, rgba(255, 255, 255, 0.55) 0 1.2px, transparent 2.2px);
    background-size: 410px 640px, 370px 640px, 290px 320px, 230px 320px, 190px 160px, 250px 160px;
    animation: eq-fx-fall 26s linear infinite, eq-fx-sway 7s ease-in-out infinite;
}

html[data-effect="rain"] body::after {
    top: -640px;
    background-image:
        radial-gradient(1px 15px at 20px 40px, rgba(190, 205, 230, 0.55), transparent),
        radial-gradient(1px 12px at 110px 200px, rgba(190, 205, 230, 0.5), transparent),
        radial-gradient(1px 18px at 60px 380px, rgba(190, 205, 230, 0.45), transparent),
        radial-gradient(1px 10px at 150px 100px, rgba(190, 205, 230, 0.4), transparent),
        radial-gradient(1px 13px at 40px 60px, rgba(190, 205, 230, 0.35), transparent),
        radial-gradient(1px 9px at 90px 120px, rgba(190, 205, 230, 0.3), transparent);
    background-size: 170px 640px, 230px 640px, 130px 640px, 190px 320px, 110px 160px, 150px 160px;
    animation: eq-fx-fall 1.1s linear infinite;
}

html[data-effect="stars"] body::after {
    left: -360px;
    background-image:
        radial-gradient(circle at 20px 40px, rgba(255, 255, 255, 0.95) 0 1.4px, transparent 2.4px),
        radial-gradient(circle at 200px 130px, rgba(255, 255, 255, 0.85) 0 1px, transparent 2px),
        radial-gradient(circle at 70px 90px, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 300px 210px, rgba(255, 244, 214, 0.9) 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 40px 20px, rgba(214, 228, 255, 0.6) 0 0.8px, transparent 1.8px);
    background-size: 360px 260px, 180px 190px, 120px 150px, 360px 330px, 90px 110px;
    animation: eq-fx-twinkle 3.5s ease-in-out infinite alternate, eq-fx-drift 160s linear infinite;
}

html[data-effect="bubbles"] body::after {
    bottom: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(circle at 80px 120px, transparent 0 9px, rgba(var(--accent-rgb), 0.55) 10px 11px, transparent 12.5px),
        radial-gradient(circle at 260px 470px, transparent 0 6px, rgba(var(--accent-rgb), 0.5) 7px 8px, transparent 9.5px),
        radial-gradient(circle at 150px 60px, transparent 0 4px, rgba(var(--accent-rgb), 0.45) 5px 6px, transparent 7.5px),
        radial-gradient(circle at 40px 250px, transparent 0 12px, rgba(var(--accent-rgb), 0.35) 13px 14px, transparent 15.5px),
        radial-gradient(circle at 110px 90px, transparent 0 2px, rgba(var(--accent-rgb), 0.5) 3px 4px, transparent 5.5px);
    background-size: 430px 640px, 390px 640px, 310px 320px, 270px 640px, 210px 160px;
    animation: eq-fx-rise 34s linear infinite, eq-fx-sway 9s ease-in-out infinite;
}

/* Cards appear one after another when a page opens (instead of the whole page fading in) */
@keyframes eq-card-fade { from { opacity: 0; } }
@keyframes eq-card-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes eq-card-pop { from { opacity: 0; transform: scale(0.96); } }

html[data-card-in="fade"] .tab-content.active > * { animation: eq-card-fade 0.45s ease-out backwards; }
html[data-card-in="rise"] .tab-content.active > * { animation: eq-card-rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
html[data-card-in="pop"] .tab-content.active > * { animation: eq-card-pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards; }

html[data-card-in] .tab-content.active > :nth-child(2) { animation-delay: 60ms; }
html[data-card-in] .tab-content.active > :nth-child(3) { animation-delay: 120ms; }
html[data-card-in] .tab-content.active > :nth-child(4) { animation-delay: 180ms; }
html[data-card-in] .tab-content.active > :nth-child(5) { animation-delay: 240ms; }
html[data-card-in] .tab-content.active > :nth-child(n+6) { animation-delay: 300ms; }

/* Cards under the pointer: lift up, or glow in the accent color */
html[data-card-hover] :is(.module-card, .theme-tile, .layout-preset,
    .sugg-card, .settings-card) {
    transition: transform var(--move-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out), border-color var(--motion-base) var(--ease-out);
}

html[data-card-hover="lift"] :is(.module-card, .theme-tile,
    .layout-preset, .sugg-card):hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

html[data-card-hover="glow"] :is(.module-card, .theme-tile,
    .layout-preset, .sugg-card, .settings-card):hover {
    border-color: rgba(var(--accent-rgb), 0.55);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.3), 0 0 26px rgba(var(--accent-rgb), 0.22);
}

/* Animation turned down: nothing moves. Stars stay as a still sky; the other effects
   only make sense moving, so they go. */
[data-motion="reduced"] body::before,
[data-motion="reduced"] body::after {
    animation: none !important;
    translate: none !important;
}

[data-motion="reduced"][data-effect]:not([data-effect="stars"]) body::after {
    display: none;
}

[data-motion="reduced"] .tab-content.active > * {
    animation: none !important;
}

[data-motion="reduced"][data-card-hover="lift"] :is(.module-card,
    .theme-tile, .layout-preset, .sugg-card):hover {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="on"]) body::before,
    :root:not([data-motion="on"]) body::after {
        animation: none !important;
        translate: none !important;
    }

    html:not([data-motion="on"])[data-effect]:not([data-effect="stars"]) body::after {
        display: none;
    }

    :root:not([data-motion="on"]) .tab-content.active > * {
        animation: none !important;
    }

    html:not([data-motion="on"])[data-card-hover="lift"] :is(.module-card,
        .theme-tile, .layout-preset, .sugg-card):hover {
        transform: none;
    }
}

/* ── More effects (theme editor: Animation). Same rules as above: one layer behind the cards,
   larger than the window by exactly one repeat along the way it moves, so it loops
   without a jump; transform and opacity only; nothing moves for people who ask for less. */
html[data-effect="fireflies"] body::after {
    left: -360px;
    background-image:
        radial-gradient(circle at 40px 60px, rgba(var(--accent-rgb), 0.95) 0 1.6px, rgba(var(--accent-rgb), 0.25) 3px, transparent 7px),
        radial-gradient(circle at 150px 170px, rgba(255, 236, 150, 0.9) 0 1.4px, rgba(255, 236, 150, 0.22) 3px, transparent 6px),
        radial-gradient(circle at 70px 40px, rgba(var(--accent-rgb), 0.75) 0 1.2px, transparent 5px),
        radial-gradient(circle at 20px 120px, rgba(255, 236, 150, 0.7) 0 1.1px, transparent 4.5px);
    background-size: 360px 320px, 180px 340px, 120px 260px, 90px 300px;
    animation: eq-fx-twinkle 2.4s ease-in-out infinite alternate, eq-fx-drift 110s linear infinite,
        eq-fx-sway 12s ease-in-out infinite;
}

html[data-effect="petals"] body::after {
    top: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(7px 4px at 60px 100px, rgba(255, 182, 206, 0.9), transparent),
        radial-gradient(6px 3.5px at 220px 400px, rgba(255, 196, 214, 0.85), transparent),
        radial-gradient(6.5px 4px at 140px 60px, rgba(248, 170, 196, 0.8), transparent),
        radial-gradient(5px 3px at 30px 250px, rgba(255, 210, 224, 0.75), transparent),
        radial-gradient(4.5px 3px at 100px 30px, rgba(255, 190, 210, 0.6), transparent);
    background-size: 410px 640px, 370px 640px, 290px 320px, 230px 320px, 190px 160px;
    animation: eq-fx-fall 32s linear infinite, eq-fx-sway 6s ease-in-out infinite;
}

html[data-effect="leaves"] body::after {
    top: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(9px 5px at 70px 120px, rgba(214, 120, 40, 0.85), transparent),
        radial-gradient(8px 4.5px at 240px 430px, rgba(190, 80, 30, 0.8), transparent),
        radial-gradient(8.5px 5px at 130px 50px, rgba(226, 170, 60, 0.8), transparent),
        radial-gradient(7px 4px at 40px 240px, rgba(160, 90, 40, 0.75), transparent);
    background-size: 430px 640px, 390px 640px, 310px 320px, 250px 320px;
    animation: eq-fx-fall 38s linear infinite, eq-fx-sway 8s ease-in-out infinite;
}

html[data-effect="embers"] body::after {
    bottom: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(circle at 80px 120px, rgba(255, 170, 70, 0.95) 0 1.4px, rgba(255, 120, 40, 0.35) 3px, transparent 5px),
        radial-gradient(circle at 260px 470px, rgba(255, 140, 50, 0.85) 0 1.2px, rgba(255, 100, 30, 0.3) 2.6px, transparent 4.5px),
        radial-gradient(circle at 150px 60px, rgba(255, 200, 110, 0.8) 0 1px, transparent 3.5px),
        radial-gradient(circle at 40px 250px, rgba(255, 150, 60, 0.7) 0 1px, transparent 3.5px);
    background-size: 430px 640px, 390px 640px, 310px 320px, 270px 640px;
    animation: eq-fx-rise 24s linear infinite, eq-fx-sway 5s ease-in-out infinite,
        eq-fx-twinkle 1.8s ease-in-out infinite alternate;
}

html[data-effect="confetti"] body::after {
    top: -640px;
    left: -16px;
    right: -16px;
    background-image:
        radial-gradient(3.5px 6px at 60px 100px, rgba(242, 193, 78, 0.9), transparent),
        radial-gradient(5.5px 3px at 200px 420px, rgba(86, 198, 226, 0.9), transparent),
        radial-gradient(3.5px 6px at 120px 60px, rgba(239, 122, 182, 0.9), transparent),
        radial-gradient(5.5px 3.5px at 30px 230px, rgba(92, 201, 138, 0.9), transparent),
        radial-gradient(3px 5.5px at 90px 40px, rgba(169, 140, 246, 0.9), transparent),
        radial-gradient(5.5px 3px at 150px 120px, rgba(245, 155, 94, 0.9), transparent);
    background-size: 410px 640px, 370px 640px, 290px 320px, 230px 320px, 190px 160px, 250px 160px;
    animation: eq-fx-fall 20s linear infinite, eq-fx-sway 4s ease-in-out infinite;
}

/* ── Effects drawn on a canvas (effects.js): the newer built-in ones and the ones people make.
   The same place as the effects above: over the page background, behind everything else. */
.fx-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Choosing an effect, and making your own (Preferences > Look, and the theme editor) */
.effect-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-inner);
}

.effect-pick .settings-select {
    flex: 1 1 240px;
    max-width: 360px;
}

.effect-panel {
    flex-basis: 100%;
    margin-top: var(--space-1);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border-color);
}

.effect-own {
    padding: var(--space-4);
    background: color-mix(in srgb, var(--text-main) 3%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.effect-builder > .theme-editor-fields:first-child {
    margin-top: 0;
}

.effect-builder-heading {
    margin: var(--space-field) 0 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-main);
}

.effect-colors {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.effect-colors > .text-muted {
    font-size: 0.85rem;
}

.effect-color {
    position: relative;
    display: inline-flex;
}

.effect-color input[type="color"] {
    width: 46px;
    height: 34px;
    padding: 0;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

.effect-color-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.65rem;
    color: var(--text-normal);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
}

.effect-color-remove:hover {
    color: var(--danger-text);
}

.effect-color-remove:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ── Backdrops (theme editor: Backdrop): drawn from the theme's colors on a page with no
   picture, on the same fixed layer a picture uses, at the theme's strength ─────────── */
html[data-backdrop] body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: var(--backdrop-strength, 0.3);
}

html[data-backdrop] .main-content {
    background-color: transparent;
}

html[data-backdrop="gradient"] body::before {
    background: linear-gradient(135deg, var(--primary), transparent 52%, var(--accent));
}

html[data-backdrop="glow"] body::before {
    background: radial-gradient(70% 55% at 50% 0%, var(--accent), transparent 72%);
}

html[data-backdrop="dots"] body::before {
    background: radial-gradient(var(--accent) 1.2px, transparent 1.7px) 0 0 / 22px 22px;
}

html[data-backdrop="grid"] body::before {
    background:
        linear-gradient(var(--accent) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, var(--accent) 1px, transparent 1px) 0 0 / 40px 40px;
}

/* Aurora: soft light in the theme's colors, drifting slowly (still for anyone who asks for
   less motion, by the rules above for the picture layer) */
@keyframes eq-aurora {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    50% { transform: translate(4%, -3%) rotate(8deg) scale(1.08); }
    100% { transform: translate(-3%, 4%) rotate(-6deg) scale(1.04); }
}

html[data-backdrop="aurora"] body::before {
    inset: -20%;
    background:
        radial-gradient(40% 35% at 20% 25%, var(--accent), transparent 70%),
        radial-gradient(35% 40% at 80% 20%, var(--primary), transparent 70%),
        radial-gradient(45% 40% at 60% 85%, var(--success), transparent 70%);
    filter: blur(48px);
    animation: eq-aurora 32s ease-in-out infinite alternate;
}

/* ── Theme details (theme editor: Details) ──────────────────────────────────────────── */

/* Card accents: an edge or a glow in the links color */
html[data-card-accent="top"] .main-content :is(.settings-card, .module-card, .mod-list,
    .sugg-card, .perm-role) {
    border-top: 3px solid var(--accent);
}

html[data-card-accent="left"] .main-content :is(.settings-card, .module-card, .mod-list,
    .sugg-card, .perm-role) {
    border-left: 3px solid var(--accent);
}

html[data-card-accent="glow"] .main-content :is(.settings-card, .module-card, .mod-list,
    .sugg-card, .perm-role) {
    border-color: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18), 0 0 24px rgba(var(--accent-rgb), 0.12);
}

/* The menu: tinted with the links color, or floating as a panel of its own (beside the page) */
html[data-menu-style="tinted"] .sidebar {
    background-color: color-mix(in srgb, var(--accent) 8%, var(--bg-darker));
}

html[data-menu-style="floating"]:is([data-nav-position="left"], [data-nav-position="right"]) .sidebar {
    margin: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

/* Buttons: solid (standard), soft, outlined, or a gradient from the buttons color to the links color */
html[data-buttons="soft"] .btn-primary {
    background-color: rgba(var(--accent-rgb), 0.16);
    border-color: transparent;
    color: var(--accent);
}

html[data-buttons="soft"] .btn-primary:hover {
    background-color: rgba(var(--accent-rgb), 0.26);
    border-color: transparent;
}

html[data-buttons="outline"] .btn-primary {
    background-color: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

html[data-buttons="outline"] .btn-primary:hover {
    background-color: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent);
}

html[data-buttons="gradient"] .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
}

/* A font for headings, apart from the text's (the bot's name, which is the brand, keeps its own) */
html[data-heading-font] :is(h1, h2, h3, h4):not(.brand-name) {
    font-family: var(--font-heading);
}

html[data-heading-font="default"] { --font-heading: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html[data-heading-font="rounded"] { --font-heading: 'Nunito', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html[data-heading-font="geometric"] { --font-heading: 'Poppins', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html[data-heading-font="serif"] { --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif; }
html[data-heading-font="mono"] { --font-heading: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace; }
html[data-heading-font="readable"] { --font-heading: 'Atkinson Hyperlegible', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }

/* Menu icons: the links color, or a color per group of pages (by page, so a pinned page
   keeps its group's color) */
html[data-nav-icons="accent"] .sidebar .nav li > i {
    color: var(--accent);
}

html[data-nav-icons="colorful"] .sidebar .nav li > i {
    color: var(--nav-icon, var(--text-muted));
}

.nav li:is([data-tab="dashboard"], [data-tab="analytics"], [data-tab="activity-log"]) { --nav-icon: #5b92dc; }
.nav li:is([data-tab="wl-security"], [data-tab="checkup"], [data-tab="backups"]) { --nav-icon: #e5645e; }
.nav li:is([data-tab="members"], [data-tab="moderator"], [data-tab="automod"], [data-tab="discord-bans"],
    [data-tab="channel-restrictions"]) { --nav-icon: #e8913a; }
.nav li:is([data-tab="welcome"], [data-tab="invites"], [data-tab="suggestions"]) { --nav-icon: #4fb97a; }
.nav li:is([data-tab="ticketing"], [data-tab="transcripts"], [data-tab="applications"], [data-tab="forms"],
    [data-tab="vouches"]) { --nav-icon: #9d7ae6; }
.nav li:is([data-tab="embeds"], [data-tab="sticky-messages"], [data-tab="custom-commands"]) { --nav-icon: #34b8b0; }
.nav li:is([data-tab="config"], [data-tab="modules"], [data-tab="permissions"], [data-tab="staff-names"],
    [data-tab="server-tools"]) { --nav-icon: #94a3b8; }
.nav li:is([data-tab="bot-identity"], [data-tab="developer"]) { --nav-icon: #d9a53c; }

html[data-theme="light"] .nav li:is([data-tab="dashboard"], [data-tab="analytics"], [data-tab="activity-log"]) { --nav-icon: #2463c2; }
html[data-theme="light"] .nav li:is([data-tab="wl-security"], [data-tab="checkup"], [data-tab="backups"]) { --nav-icon: #c53030; }
html[data-theme="light"] .nav li:is([data-tab="members"], [data-tab="moderator"], [data-tab="automod"],
    [data-tab="discord-bans"], [data-tab="channel-restrictions"]) { --nav-icon: #c2410c; }
html[data-theme="light"] .nav li:is([data-tab="welcome"], [data-tab="invites"], [data-tab="suggestions"]) { --nav-icon: #15803d; }
html[data-theme="light"] .nav li:is([data-tab="ticketing"], [data-tab="transcripts"], [data-tab="applications"],
    [data-tab="forms"], [data-tab="vouches"]) { --nav-icon: #6d28d9; }
html[data-theme="light"] .nav li:is([data-tab="embeds"], [data-tab="sticky-messages"], [data-tab="custom-commands"]) { --nav-icon: #0f766e; }
html[data-theme="light"] .nav li:is([data-tab="config"], [data-tab="modules"], [data-tab="permissions"],
    [data-tab="staff-names"], [data-tab="server-tools"]) { --nav-icon: #475569; }
html[data-theme="light"] .nav li:is([data-tab="bot-identity"], [data-tab="developer"]) { --nav-icon: #a35c00; }

/* ── The person's own look (Preferences > Look and Layout) ────────────────────────────
   On <html> from their preferences. Their colors (accent, status, contrast) are custom
   properties set by appearance.js. */

/* Cards: flat (no outlines) or raised (a shadow) */
html[data-cards="flat"] .main-content :is(.settings-card,
    .module-card, .mod-list, .mod-rail, .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat,
    .sec-protections, .data-table-wrap, .tools-summary, .sugg-card, .perm-role) {
    border-color: transparent;
    box-shadow: none;
}

html[data-cards="raised"] .main-content :is(.settings-card,
    .module-card, .mod-list, .mod-rail, .theme-tile, .layout-preset, .layout-options, .sec-banner, .sec-threat,
    .sec-protections, .data-table-wrap, .tools-summary, .sugg-card, .perm-role) {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 26px rgba(0, 0, 0, 0.24);
}

html[data-theme="light"][data-cards="raised"] .main-content :is(.settings-card,
    .module-card, .mod-list, .mod-rail, .theme-tile, .layout-preset, .layout-options, .sec-banner,
    .sec-threat, .sec-protections, .data-table-wrap, .tools-summary, .sugg-card,
    .perm-role) {
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 10px 26px rgba(17, 24, 39, 0.1);
}

/* Profile pictures (Discord's own previews keep Discord's round ones) */
html[data-avatars="rounded"] :is(.account-avatar, .app-avatar, .app-avatar-blank, .app-avatar-lg, .sec-avatar,
    .sec-avatar-empty, .sec-avatar-lg, .slog-avatar, .slog-avatar-blank) {
    border-radius: 28%;
}

html[data-avatars="square"] :is(.account-avatar, .app-avatar, .app-avatar-blank, .app-avatar-lg, .sec-avatar,
    .sec-avatar-empty, .sec-avatar-lg, .slog-avatar, .slog-avatar-blank) {
    border-radius: 4px;
}

/* A faint texture behind the pages; a theme's picture or backdrop takes its place */
html:not([data-bg="picture"]):not([data-backdrop]):is([data-texture="dots"], [data-texture="grid"],
    [data-texture="lines"], [data-texture="diagonal"]) .main-content {
    --texture-ink: color-mix(in srgb, var(--text-main) 7%, transparent);
    background-attachment: local;
}

html:not([data-bg="picture"]):not([data-backdrop])[data-texture="dots"] .main-content {
    background-image: radial-gradient(var(--texture-ink) 1px, transparent 1.5px);
    background-size: 18px 18px;
}

html:not([data-bg="picture"]):not([data-backdrop])[data-texture="grid"] .main-content {
    background-image: linear-gradient(var(--texture-ink) 1px, transparent 1px),
        linear-gradient(90deg, var(--texture-ink) 1px, transparent 1px);
    background-size: 32px 32px;
}

html:not([data-bg="picture"]):not([data-backdrop])[data-texture="lines"] .main-content {
    background-image: linear-gradient(var(--texture-ink) 1px, transparent 1px);
    background-size: 100% 28px;
}

html:not([data-bg="picture"]):not([data-backdrop])[data-texture="diagonal"] .main-content {
    background-image: repeating-linear-gradient(45deg, var(--texture-ink) 0 1px, transparent 1px 14px);
}

/* Scrollbars: in the accent color, or wide enough to grab easily */
html[data-scrollbars="accent"] * {
    scrollbar-color: rgba(var(--accent-rgb), 0.6) transparent;
}

html[data-scrollbars="wide"] * {
    scrollbar-width: auto;
}

/* The menu's current page: soft (standard), a bar, filled with the buttons color, or outlined */
html[data-nav-active="bar"] .nav li.active {
    background-color: transparent;
}

html[data-nav-active="solid"] .nav li.active {
    background-color: var(--primary);
    box-shadow: none;
    color: var(--on-primary);
}

html[data-nav-active="solid"] .nav li.active > i {
    color: #fff;
}

html[data-nav-active="outline"] .nav li.active {
    background-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.65);
}

/* Line spacing */
html[data-leading="relaxed"] .main-content :is(p, li, dd, td, label, small, .text-muted):not(.sidebar *) {
    line-height: 1.7;
}

/* Opening a page: fade (standard, under "Motion"), come up a short way as well, or be there at once. A theme
   whose cards appear one by one does its own. */
@starting-style {
    html[data-page-in="slide"] .tab-content.active {
        translate: 0 var(--move-far);
    }
}

html:is([data-page-in="none"], [data-card-in]) .tab-content.active {
    transition: none;
}

/* Short notices at the top right, under the top bar (and a menu along the top) */
html[data-toasts="top"] .toast {
    top: calc(var(--toast-top, 58px) + var(--space-4));
    bottom: auto;
    translate: 0 calc(var(--move-far) * -1);
}

html[data-toasts="top"] .toast.show {
    translate: none;
}

/* High contrast: stronger focus outlines as well as the stronger colors */
html[data-contrast="high"] :focus-visible {
    outline-width: 3px;
    outline-offset: 2px;
}

html[data-contrast="high"] .nav li:not(.active) {
    color: var(--text-normal);
}

/* Preferences: the accent color swatches */
.accent-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.accent-swatch {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: var(--swatch, var(--primary));
    box-shadow: 0 0 0 1px var(--border-color);
    cursor: pointer;
}

.accent-swatch.is-theme {
    background: conic-gradient(#5b92dc, #a98cf6, #ef7ab6, #f59b5e, #eec057, #5cc98a, #46cdbd, #5b92dc);
}

.accent-swatch.is-selected {
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-main);
}

.accent-swatch:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* Preferences: tab panels (each a stack; its sections are spaced by the stack) */
.prefs-panel > .appearance-section {
    margin-bottom: 0;
}

/* The Day and night theme tile: light meeting dark. Drawn once inside the outline (padding-box,
   no-repeat): a repeating gradient would wrap round under the 1px border and show slivers of the
   other colors along the edges. */
.theme-swatches-daynight {
    background: linear-gradient(135deg, #f3f4f6 0 48%, #eec057 48% 52%, #14171c 52% 100%) no-repeat padding-box;
}

/* Theme editor: a line under a field saying what its choices do, and fields that need a whole row */
.theme-field-hint {
    margin: var(--space-hint) 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.theme-editor-fields > .is-wide {
    grid-column: 1 / -1;
}

/* Theme editor: animations are paused for the person editing (they asked for less motion) */
.theme-motion-notice {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-inner);
    padding: var(--space-3) var(--space-4);
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--text-normal);
    background: color-mix(in srgb, var(--warning) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    border-radius: 8px;
}

.theme-motion-notice > i {
    color: var(--warning-text);
    font-size: 1rem;
}

.theme-motion-notice p {
    flex: 1;
    margin: 0;
}

/* (at the notice's end: its words keep to the measure, so beside them the button stood mid-notice) */
.theme-motion-notice .btn {
    flex-shrink: 0;
    margin-left: auto;
}

.theme-editor-fields > .theme-motion-notice {
    margin: 0;
}

/* A setting another part of the page pointed to ("Show the setting") */
@keyframes eq-pointed-out {
    from { background-color: rgba(var(--accent-rgb), 0.22); }
    to { background-color: transparent; }
}

:is(.layout-option, .module-field, .mod-row, .form-group).is-pointed-out {
    animation: eq-pointed-out 2.4s ease-out;
    border-radius: 6px;
}

/* Where to switch on a Server Tools change (serverToolsHint): many members at once, a category with its channels */
/* (one run of text with its link in it: as a row of boxes that wraps, the words after the link dropped to a
   line of their own under the icon while half the line was free) */
.tools-hint {
    margin: 0 0 var(--space-3);
    font-size: 0.82rem;
    line-height: 1.45;          /* (room between its lines when it takes two, as .perm-hint has) */
    color: var(--text-muted);
    text-wrap: pretty;          /* (no last line of one or two words, where the browser can avoid it) */
}

.tools-hint i {
    margin-right: var(--space-1);
    color: var(--text-dark);
}

/* Permissions: what a section's levels allow, when that isn't obvious */
.perm-hint {
    margin: var(--space-2) 0 0;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-muted);
}

/* ── Permissions page: roles and the level each has on every page ───────────
   Levels take the theme's colors: Edit success, Write primary, Read muted text,
   None dimmed text (permissions.js). */
.perm-level-chip,
.perm-dot,
.perm-level-btn {
    --level-color: var(--text-dark);
}

:is(.perm-level-chip, .perm-dot, .perm-level-btn)[data-level="read"] { --level-color: var(--text-muted); }
:is(.perm-level-chip, .perm-dot, .perm-level-btn)[data-level="write"] { --level-color: var(--accent); }
:is(.perm-level-chip, .perm-dot, .perm-level-btn)[data-level="edit"] { --level-color: var(--success-text); }

.perm-level-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--pad-tile);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.perm-level-tile p {
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.perm-level-chip {
    padding: var(--pad-chip);
    border: 1px solid var(--level-color);
    border-radius: 4px;
    color: var(--level-color);
    font-size: 0.75rem;
    font-weight: 700;
}

.perm-levels-note {
    margin-top: var(--space-inner);
    font-size: 0.83rem;
}

.perm-roles {
    display: flex;
    flex-direction: column;
    gap: var(--space-inner);
}

.perm-role {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-darker);
}

.perm-role-top {
    display: flex;
    align-items: center;
    gap: var(--gap-row);
    padding-right: var(--space-4);
}

.perm-role-remove.is-placeholder {
    visibility: hidden;         /* holds the Remove button's place on a role that can't be removed */
}

/* (where no role in the list can be removed there is no place to hold: the arrows still share one line, at the
   cards' own edge and not a button's width short of it) */
.settings-card-body:not(:has(.perm-role-remove:not(.is-placeholder))) .perm-role-remove.is-placeholder {
    display: none;
}

.settings-card-body:not(:has(.perm-role-remove:not(.is-placeholder))) .perm-role-top {
    padding-right: 0;
}

.perm-role-head {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4) var(--space-5);
    border: 0;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.perm-role-head:hover {
    background: var(--bg-tertiary);
}

.perm-role-swatch {
    flex-shrink: 0;
    width: 4px;
    height: 40px;
    border-radius: 4px;
    background: var(--role-color, var(--text-dark));
}

.perm-role-title {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.perm-role-name {
    overflow: hidden;
    color: var(--text-main);
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.perm-role-note {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.perm-role-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-row);
    color: var(--text-muted);
    font-size: 0.78rem;
}

.perm-dots {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.perm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--level-color);
}

.perm-dot[data-level="none"] {
    background: var(--border-color);
}

.perm-role-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--move-base) var(--ease-out);
}

.perm-role-head[aria-expanded="true"] .perm-role-arrow {
    transform: rotate(180deg);
}

.perm-role-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-5);
    border-top: 1px solid var(--border-color);
}

.perm-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-row);
    margin-bottom: var(--space-2);
}

.perm-group-head h4 {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.perm-set-all {
    display: flex;
    align-items: center;
    gap: var(--gap-row);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.perm-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: var(--space-2);
}

.perm-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.perm-section-name {
    color: var(--text-normal);
    font-size: 0.85rem;
    font-weight: 600;
}

.perm-picker {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.perm-level-btn {
    padding: var(--pad-control-sm);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-darker);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.perm-level-btn:hover:not(:disabled) {
    border-color: var(--level-color);
    color: var(--text-main);
}

.perm-level-btn[aria-pressed="true"] {
    border-color: var(--level-color);
    background: color-mix(in srgb, var(--level-color) 24%, var(--bg-darker));
    color: var(--text-main);
}

.perm-level-btn[data-level="none"][aria-pressed="true"] {
    border-color: var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.perm-level-btn:disabled {
    cursor: not-allowed;
}

.perm-level-btn:disabled:not([aria-pressed="true"]) {
    opacity: 0.45;
}

/* Command access: a row per staff command, allowed or not for the role */
.cmd-perm-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.cmd-perm-row {
    display: flex;
    align-items: center;
    gap: var(--gap-row);
    padding: var(--pad-cell);
}

.cmd-perm-row + .cmd-perm-row {
    border-top: 1px solid var(--border-color);
}

.cmd-perm-row code {
    color: var(--accent);
    font-size: 0.8rem;
}

.cmd-perm-desc {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cmd-perm-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pad-control-sm);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-darker);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.cmd-perm-toggle[aria-pressed="true"] {
    border-color: var(--success);
    color: var(--success-text);
}

@media (max-width: 640px) {
    .perm-role-head {
        padding: var(--space-3) var(--space-4);
    }

    .perm-group-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cmd-perm-desc {
        display: none;
    }
}

/* ── A state beside something: a dot and a word, in the theme's status colors ── */
.state-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--pad-chip);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.state-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.state-chip.is-good { color: var(--success-text); }
.state-chip.is-warn { color: var(--warning-text); }
.state-chip.is-bad { color: var(--danger-text); }

.mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8rem;
}

.data-table tr.is-dimmed td,
.data-table tr.is-dimmed td :is(code, .state-chip) {
    color: var(--text-muted);
}

/* Staff Roster: your own name, and the name column */
.staff-name-me {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

.staff-name-value {
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 700;
}

.staff-name-value.is-unset {
    color: var(--text-muted);
    font-weight: 600;
}

.staff-name-cell {
    color: var(--accent);
    font-weight: 600;
}

/* ── Empty states: a message where a list or page has nothing to show yet ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-10) var(--space-4);
    color: var(--text-muted);
    text-align: center;
}

.empty-state > i {
    color: var(--text-dark);
    font-size: 2rem;
}

.empty-state-title {
    color: var(--text-normal);
    font-weight: 600;
}

.empty-state-line {
    padding: var(--space-6) var(--space-4);
    color: var(--text-muted);
    text-align: center;
}

.empty-state-line.is-error {
    color: var(--danger-text);
}

/* ── A list beside what it opens or narrows (the Features page's features, the Commands page's groups) ──
   The list stays in view while the page scrolls; on narrow screens it becomes a menu. */
.modules-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: var(--space-page);
    align-items: start;
}

.mod-rail-wrap {
    position: sticky;
    top: var(--space-4);
}

/* The list scrolls inside its own frame where it is taller than the window: the border and the round corners
   stay where they are. (The frame used to be scrolled along inside a plain box, so a list scrolled halfway
   ended in a straight cut at the top and the bottom.) */
.mod-rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    max-height: calc(var(--view-h, 100vh) - var(--space-8));
    overflow-y: auto;
    scrollbar-width: thin;
    padding: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* Where a list or a panel that scrolls in its own frame goes on above or below what shows, that edge is shaded,
   so one that ends at its frame reads as one that scrolls (a scrollbar alone is thin, and some systems only
   draw it while scrolling). The shade stays at the frame's edges, drawn twice because once is too faint on a
   dark card; a strip in the card's color scrolls with the content and covers it once the first or the last
   line is in view. */
.mod-rail,
.settings-card.smap-detail-card > .settings-card-body {
    background-image:
        linear-gradient(var(--bg-card) 40%, transparent),
        linear-gradient(transparent, var(--bg-card) 60%),
        linear-gradient(var(--shadow-primary), transparent),
        linear-gradient(var(--shadow-primary), transparent),
        linear-gradient(transparent, var(--shadow-primary)),
        linear-gradient(transparent, var(--shadow-primary));
    background-position: top, bottom, top, top, bottom, bottom;
    background-size: 100% var(--space-12), 100% var(--space-12), 100% var(--space-8), 100% var(--space-8),
                     100% var(--space-8), 100% var(--space-8);
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll, scroll, scroll;
}

.mod-rail > * {
    flex: none;     /* (a row keeps its height: the list scrolls, it doesn't squeeze) */
}

.mod-rail-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    margin-top: var(--space-3);
}

.mod-rail-title {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-2);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.mod-rail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-2);
    background: none;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    text-align: left;
    color: var(--text-normal);
    cursor: pointer;
}

.mod-rail-item:hover {
    color: var(--text-main);
    background: color-mix(in srgb, var(--text-main) 5%, transparent);
}

.mod-rail-item.is-selected {
    font-weight: 600;
    color: var(--accent);
    background: var(--nav-active-bg);
    box-shadow: inset 3px 0 0 var(--primary);
}

.mod-rail-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* A feature's name, and a crown beside what comes with Premium: the name gives way, the crown stays */
.mod-rail-label {
    display: flex;
    align-items: center;
    min-width: 0;
}

.mod-rail-label .premium-badge {
    flex-shrink: 0;
    margin-left: var(--space-1);
}

.mod-rail-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mod-rail-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.mod-rail-item.is-selected .mod-rail-count {
    color: inherit;
}

.mod-rail-empty {
    margin: var(--space-2) var(--space-2);
    font-size: 0.82rem;
}

/* On or off, with a dot so it doesn't rely on color alone */
.mod-state {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.mod-state.is-on {
    color: var(--success-text);
}

.mod-state.is-on::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: var(--space-1);
    vertical-align: 1px;
    border-radius: 50%;
    background: var(--success);
}

.mod-picker {
    display: none;
}

/* All modules: a tile per module */
.mod-overview-intro {
    margin: 0 0 var(--space-page);
    font-size: 0.88rem;
}

.mod-overview .module-category:last-child {
    margin-bottom: 0;
}

/* Every feature on one line: its name (which opens its settings), what it is, and its switch (the list's own
   box is with .slog-rows) */
.mod-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding-right: var(--pad-card-x);
}

.mod-row + .mod-row {
    border-top: 1px solid var(--border-color);
}

.mod-row-open {
    display: grid;
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    flex: 1;
    min-width: 0;
    padding: var(--space-3) 0 var(--space-3) var(--pad-card-x);
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.mod-row-open:hover .mod-row-name {
    color: var(--accent);
}

.mod-row-open:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.mod-row-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}

.mod-row-desc {
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-muted);
}

/* An open row that says in full what the feature does (the Everything view) doesn't say it in short above that
   too: the two lines read as one sentence said twice. The line keeps its place, so nothing moves. */
.mod-row:has(> .mod-row-panel:not([hidden]) > .mod-row-about) > .mod-row-open > .mod-row-desc {
    visibility: hidden;
}

.mod-row .module-commands {
    grid-column: 2;
}

/* An open row's full description and commands (Everything), above its settings. (.mod-row leads the second
   selector so it outranks the "margin: 0" every row's commands get further down: without the space under them
   the commands sat on top of the first row of labels.) */
.mod-row-panel > .mod-row-about,
.mod-row .mod-row-panel > .module-commands {
    margin: 0 0 var(--space-3);
}

.mod-row-about {
    max-width: 90ch;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.mod-row-panel > .module-commands {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--accent);
}

/* On a feature's own page a row opens to its settings instead of leaving the page */
.mod-row-fold {
    flex-wrap: wrap;
    row-gap: 0;
}

.mod-row-fold .mod-row-name::before {
    content: '';
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    margin-right: var(--space-3);
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    vertical-align: 0.12em;
    transform: rotate(-45deg);
    transition: transform var(--move-fast) var(--ease-out);
}

.mod-row-fold [aria-expanded="true"] .mod-row-name::before {
    transform: rotate(45deg);
}

.mod-row-panel {
    flex-basis: 100%;
    /* (as wide as its row and no wider: a table inside scrolls in its own box, and no longer pushes the page
       sideways on a narrow screen) */
    min-width: 0;
    padding: var(--space-2) 0 var(--space-4) var(--pad-card-x);
}

/* A row with nothing in it to open (the console's "Tickets: none"): it is no button, and its name stands under
   the names of the rows that do open, which have their arrow in front */
.mod-row-plain {
    cursor: default;
}

.mod-row-plain:hover .mod-row-name {
    color: var(--text-main);
}

.mod-row-plain .mod-row-name::before {
    content: '';
    display: inline-block;
    width: 0.4rem;
    margin-right: var(--space-3);
    border-right: 2px solid transparent;
}

/* What stands on record about one thing, a label and a line each (the console's account: what it is held for,
   why it was caught, where it was removed) */
.case-facts {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    margin: var(--space-4) 0 0;
}

.case-facts dt {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.case-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .case-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-0-5) 0;
    }

    .case-facts dd {
        margin-bottom: var(--space-2);
    }
}

@media (max-width: 640px) {
    .mod-row {
        gap: var(--space-3);
        padding-right: var(--space-3);
    }

    .mod-row-open {
        grid-template-columns: minmax(0, 1fr);
        padding-left: var(--space-3);
    }

    /* (a button beside the name, "Manage your applications", goes under it rather than squeeze the name to
       one word's width) */
    .mod-row-fold > .mod-row-open {
        flex-basis: 12rem;
    }

    .mod-row-panel {
        padding-left: var(--space-3);
    }

    .mod-row .module-commands {
        grid-column: 1;
    }
}

:is(.mod-row, .mod-editor-head) .module-commands {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.74rem;
    color: var(--accent);
}

/* One module: its heading, section links, sections, and the save bar */
.mod-editor,
.mod-sections {
    display: flex;
    flex-direction: column;
    gap: var(--space-page);
}

.mod-editor > .settings-card,
.mod-sections > .settings-card,
.mod-editor > .section-title,
.mod-editor > .global-notice {
    margin: 0;
}

.mod-editor-head .settings-card-header {
    align-items: center;
    border-bottom: 0;
}

.mod-editor-head p {
    max-width: 760px;
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.mod-editor-head .module-commands {
    margin-top: var(--space-2);
}

.mod-power {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
}

.mod-jump {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.mod-jump-link {
    padding: var(--space-1) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.mod-jump-link:hover {
    color: var(--text-main);
    border-color: rgba(var(--accent-rgb), 0.5);
}

.mod-jump-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* (a section jumped to stops below the editor's bar: the bar's height and a gap) */
.mod-section {
    scroll-margin-top: calc(var(--space-10) * 2);
}

.mod-section .settings-card-header h3 {
    margin: 0;
}

/* Fields side by side, up to three a row, lined up like the rest of the dashboard */
.mod-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, max(240px, calc((100% - 2.5rem) / 3))), 1fr));
    gap: 0 var(--space-5);
}

.mod-fields > .module-field-rows,
.mod-fields > .module-field-textarea,
.mod-fields > .module-field-wide {
    grid-column: 1 / -1;
}

.mod-fields > .module-field {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);    /* (a picker's longest choice can't widen it past its card) */
    row-gap: 0;
    margin-bottom: var(--space-4);
}

.mod-fields > .module-field > label {
    align-self: end;
}

.mod-fields > .module-field > :nth-child(2),
.mod-fields > .module-field > small {
    align-self: start;
}

.mod-fields > .module-field-bool > .module-bool-control {
    grid-row: 2;
    min-height: 44px;
}

.mod-fields > .module-field-bool > small {
    grid-row: 3;
}

/* A switch in a feature's form has a line to itself, after the boxes of its part (modules.js, _switchesLast):
   in a column made for a box its words wrapped, and beside two boxes it sat level with nothing. On the Features
   page and on a feature's own page (Threat Detection, Cases & Warnings, Ticket Options) alike. */
.module-form .module-field-bool.is-line {
    grid-column: 1 / -1;
}

/* "More options" and a form's folded groups are padded like the cards they sit among, so what is inside starts
   where a card's content does (the last field's own space under it makes up the bottom) */
.module-form .module-group > summary {
    padding-inline: var(--pad-card-x);
}

.module-form .module-group-body {
    padding: var(--pad-card-y) var(--pad-card-x) var(--space-1);
}

.mod-section .settings-card-body > .mod-fields {
    margin-bottom: calc(-1 * var(--space-4));
}

/* Unsaved changes, at the end of the form they belong to (the Server Map's settings). It doesn't float over the
   page: an editor's Save is in its bar at the top. */
.mod-savebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border-color));
    border-radius: 10px;
}

.mod-savebar-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

.mod-savebar-actions {
    display: flex;
    gap: var(--space-2);
}

.mod-editor-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
    font-size: 0.82rem;
}

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

    .mod-rail-wrap {
        position: static;
    }

    .mod-rail {
        display: none;
    }

    .mod-picker {
        display: block;
    }
}

/* ── Two-step sign-in (two-step.js): the screen a server shows first, the dialog, the card ─ */
.two-step-box {
    max-width: 420px;
}

.two-step-form,
.two-step-where {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}

.two-step-form > p,
.two-step-where > p,
.two-step-dialog-body > p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.two-step-form label {
    color: var(--text-normal);
    font-size: 0.85rem;
    font-weight: 600;
}

.two-step-code {
    max-width: 200px;
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
}

.two-step-qr {
    border-radius: 8px;
}

.two-step-key {
    padding: var(--space-2) var(--space-3);
    border-radius: 6px;
    background: var(--bg-tertiary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}

.two-step-help,
.two-step-gate .gate-box > p.two-step-help {
    font-size: 0.8rem;
}

.two-step-end .settings-select {
    width: auto;
}

.two-step-dialog .modal-content {
    width: 480px;
    max-width: calc(100vw - 32px);
}

.two-step-dialog-body {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6) var(--space-5);
}

.two-step-dialog-body .gate-actions {
    justify-content: flex-start;
}

.two-step-dialog-body .two-step-form,
.two-step-dialog-body .two-step-where {
    align-items: flex-start;
}

.two-step-yours {
    margin: 0;
    font-size: 0.85rem;
}

/* ── Your sign-ins (account menu, signins.js) ─────────────────────────────── */
.account-menu-form {
    margin: 0;
}

.signins-dialog .modal-content {
    width: 520px;
    max-width: calc(100vw - 32px);
}

.signins-intro {
    margin: 0;
    padding: var(--space-4) var(--space-6) var(--space-1);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.signins-list {
    padding: var(--space-2) var(--space-6) var(--space-5);
}

.signins-rows {
    margin: 0 0 var(--space-3);
    padding: 0;
    list-style: none;
}

.signins-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-color);
}

.signins-row > div {
    display: flex;
    flex-direction: column;
    gap: var(--space-0-5);
    min-width: 0;
}

.signins-row strong {
    font-size: 0.9rem;
    color: var(--text-main);
}

.signins-reauth {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-color));
    border-radius: 8px;
}

.signins-reauth p,
.signins-only {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.5;
}

/* A filter menu beside a card's buttons (Developer > Security) sizes to its options */
.tools-actions-top .settings-select {
    width: auto;
    min-width: 220px;
}

/* ── Hover states that used to be inline handlers (actions.js) ────────────── */
/* The privacy policy and terms, under the sign-in button */
/* The sign-in screen's links, spaced like the footer's (one with no address yet stays hidden). On a phone they
   take two rows, with room between them for a finger */
/* The links under the sign-in button: one row with a dot between them, the brand purple as on Equinox's
   banner ("Security · Moderation · Community"; the operator, 2026-10-16). The dot isn't part of a link's
   underline nor read out, and a link hidden for want of an address leaves no dot behind. */
.legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1) var(--space-2);
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.legal-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.legal-links a:hover,
.legal-links a:focus-visible {
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-links a:not([hidden]) ~ a:not([hidden])::before {
    content: '\00B7' / '';
    display: inline-block;
    margin-right: var(--space-2);
    color: #a462c4;
    font-weight: 800;
}

/* Narrower than the row (a phone): the links wrap, spaced apart, with no dot to start a line */
@media (max-width: 429px) {
    .legal-links {
        gap: var(--space-1) var(--space-5);
    }

    .legal-links a:not([hidden]) ~ a:not([hidden])::before {
        content: none;
    }
}

.login-discord-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-8);
    background: #5865f2;
    border-radius: 8px;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.login-discord-btn:hover,
.login-discord-btn:focus-visible {
    background: #4752c4;
}

/* The Discord mark in the sign-in buttons: an inline picture the size of the letters beside it (the icon font's
   brands file, 108 KB for this one glyph, is never fetched) */
.icon-discord {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

/* The screens before the dashboard: sign in, "no access yet", and the authenticator's (the console's too).
   The box sits in the middle by its own margins, not by the gate's alignment: when it is taller than the
   window (setting an authenticator up on a phone) the margins give way and the gate scrolls from the box's
   top, where centering would have cut its top and its buttons off for good. */
.gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    padding: var(--space-8);
    background: var(--bg-darker);
    overflow-y: auto;
}

.gate-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    max-width: 380px;
    margin: auto;
    text-align: center;
}

.gate-box > * {
    transition: opacity var(--motion-base) var(--ease-out);
}

/* The sign-in screen before the page knows who this is: the logo only, in its place, and the rest fades in
   for someone not signed in (core.js showSignIn) */
.gate.is-waiting > .gate-box > :not(.brand-mark) {
    opacity: 0;
}

.gate-box h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.gate-box > p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* Where Equinox stands, under the line that says what to do: quieter than it */
.gate-box > .gate-stage {
    font-size: 0.8rem;
    margin-top: var(--space-1);
}

.gate-box > .gate-error,
.field-error {
    color: var(--danger-text);
    font-size: 0.85rem;
}

.field-error {
    margin-top: var(--space-2);
}

.gate-actions {
    display: flex;
    gap: var(--space-2);
}

a.btn {
    text-decoration: none;
}

/* "Show all": under a list that shows its first entries (showFirst in common.js) */
.list-more {
    display: flex;
    width: fit-content;
    margin: var(--space-inner) auto 0;
}

/* A note at the start of a dialog's footer, across from its buttons */
.modal-footer-note {
    margin-right: auto;
    align-self: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Who joined with an invite */
.invite-joins-dialog {
    width: 620px;
    max-width: calc(100vw - 32px);
}

/* The staff name prompt */
.staff-name-dialog {
    width: 440px;
    max-width: calc(100vw - 32px);
}

.staff-name-dialog .modal-body {
    padding: var(--space-5) var(--space-6);
}

.staff-name-dialog .modal-body > p {
    margin-bottom: var(--space-5);
    color: var(--text-normal);
    font-size: 0.92rem;
    line-height: 1.55;
}

.staff-name-dialog .form-group {
    margin: 0;
}

.staff-name-dialog .form-group small {
    display: block;
    margin-top: var(--space-hint);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-discord-btn i {
    font-size: 1.1rem;
}

/* ── Members: pages, and the tools on a member's profile ─────────────────── */
.mem-pager {
    justify-content: space-between;
    flex-wrap: wrap;
}

.mem-pager .settings-select {
    width: auto;
}

/* A member's Log tab: which kind of event, and a way to the full Activity Log */
.mem-log-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.mem-log-bar .settings-select {
    flex: 1 1 220px;
    max-width: 360px;
}

.mem-log-bar + .global-notice {
    margin-bottom: var(--space-4);
}

.mem-log-end {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Event lists update live (server-log.js): a small marker, and new rows fade in from the accent color */
/* (at the end of the filters, on the line of their boxes) */
.slog-live {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    align-self: flex-end;
    min-height: var(--control-height);
    gap: var(--space-1);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.slog-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: slog-pulse 2s ease-in-out infinite;
}

@keyframes slog-pulse {
    50% { opacity: 0.35; }
}

@keyframes slog-new {
    from { background-color: rgba(var(--accent-rgb), 0.16); }
    to { background-color: transparent; }
}

.slog-row.is-new {
    animation: slog-new 2.5s ease-out;
}

[data-motion="reduced"] :is(.slog-live-dot, .slog-row.is-new) {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="on"]) :is(.slog-live-dot, .slog-row.is-new) {
        animation: none;
    }
}

.mem-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
}

.mem-page {
    min-width: var(--control-height);
    height: var(--control-height);
    padding: 0 var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-normal);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.mem-page:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--primary) 50%, var(--border-color));
    color: var(--text-main);
}

.mem-page:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.mem-page:disabled {
    opacity: 0.45;
    cursor: default;
}

.mem-page.is-current {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
    font-weight: 700;
}

.mem-page-gap {
    padding: 0 var(--space-1);
    color: var(--text-muted);
}

.mem-role-tools {
    margin-top: var(--space-2);
}

.mem-role-tools small {
    font-size: 0.78rem;
}

.mem-progress {
    margin: var(--space-2) 0 0;
    font-size: 0.84rem;
}

/* ── A member's moderation and clean-up actions: a row each (members.js _memRow) ── */
.mem-actions {
    padding: 0 var(--space-4);
    background: color-mix(in srgb, var(--bg-darker) 60%, transparent);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mem-action {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
}

.mem-action-text {
    flex: 1 1 240px;
    min-width: 0;
}

.mem-action-text p {
    line-height: 1.45;
}

.mem-action-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

.mem-action-controls .settings-select {
    width: auto;
}

.mem-action .mem-progress {
    margin-top: var(--space-1);
    color: var(--text-normal);
}

/* On narrow screens the rows stack (see .tools-row): text, then its controls */
@media (max-width: 700px) {
    .mem-action-text {
        flex: none;
        width: 100%;
    }

    .mem-action-controls {
        justify-content: flex-start;
    }
}

/* ── Features page: a feature with its own pages (modules.js _modAreaView) ── */
.mod-area h3 {
    margin: 0 0 var(--space-1);
    font-size: 0.95rem;
}

.mod-area h3:not(:first-child) {
    margin-top: var(--space-5);
}

.mod-area p {
    margin: 0 0 var(--space-2);
    font-size: 0.88rem;
    line-height: 1.5;
}

.module-feature-link {
    flex-shrink: 0;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* On a phone the link goes under the row's line, on a line of its own (beside it, the line was three words wide) */
@media (max-width: 640px) {
    .mod-row > .module-feature-link {
        flex-basis: 100%;
        align-self: flex-start;
        margin: calc(-1 * var(--space-3)) 0 var(--space-3) var(--space-3);   /* (under the row's own line, level with it) */
        text-align: left;
    }
}

/* ── Security check-up ─────────────────────────────────────────────────────── */
.checkup-score {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.checkup-grade {
    display: flex;
    flex-shrink: 0;
    align-items: baseline;
    gap: var(--space-1);
}

.checkup-grade strong {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.checkup-grade span {
    color: var(--text-muted);
    font-weight: 600;
}

.checkup-grade-strong strong,
.checkup-grade-good strong { color: var(--status-good); }
.checkup-grade-fair strong { color: var(--status-warning); }
.checkup-grade-risk strong { color: var(--status-critical); }

.checkup-score-text {
    flex: 1;
    min-width: 0;
}

.checkup-score-text h3 {
    margin: 0 0 var(--space-2);
}

.checkup-score-text p {
    margin: var(--space-2) 0 0;
}

.checkup-meter {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.checkup-meter-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.checkup-meter-fill.checkup-grade-strong,
.checkup-meter-fill.checkup-grade-good { background: var(--status-good); }
.checkup-meter-fill.checkup-grade-fair { background: var(--status-warning); }
.checkup-meter-fill.checkup-grade-risk { background: var(--status-critical); }

.checkup-summary.is-busy {
    opacity: 0.6;
}

/* The findings: one list of rows that open (.mod-list). How bad it is has a column of its own, so the titles
   start level whatever the word is; where it is fixed sits at the row's end. */
.checkup-rows .mod-row-name {
    display: flex;
    align-items: center;
    min-width: 0;
}

.checkup-row-level {
    flex: none;
    width: 7.5rem;
}

/* "Not checked" is neither good nor bad: its mark takes no risk color */
.checkup-row-level .sec-chip-unknown i {
    color: var(--text-muted);
}

@media (min-width: 641px) {
    .checkup-rows .mod-row-open {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
}

.checkup-rows .mod-row-panel {
    padding-right: var(--pad-card-x);
}

/* On a phone there is no room for a column: the level leads the title's first line and the title wraps under it */
@media (max-width: 640px) {
    .checkup-rows .mod-row-name {
        display: block;
    }

    .checkup-row-level {
        display: inline-block;
        width: auto;
        margin-right: var(--space-2);
        vertical-align: middle;
    }

    .checkup-rows .mod-row-panel {
        padding-right: var(--space-3);
    }
}

.checkup-row p,
.checkup-note {
    margin: 0;
}

.checkup-note,
.checkup-manual {
    color: var(--text-muted);
}

.checkup-manual {
    display: flex;
    align-items: flex-start;
    gap: var(--gap-icon);
}

.checkup-manual i {
    margin-top: var(--space-1);
}

/* The blast radius table: what a thief could do, and what stands in the way */
.checkup-list {
    margin: 0;
    padding-left: var(--space-4);
}

.checkup-list li + li {
    margin-top: var(--space-1);
}

.checkup-person {
    margin-top: var(--space-1);
    font-weight: 600;
}

.checkup-blast td {
    vertical-align: top;
}

.checkup-row .sec-tag {
    margin-left: var(--space-2);
}

.checkup-passed {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.checkup-passed li {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-width: var(--measure);      /* (the measure a finding's own words keep to) */
}

.checkup-row .fa-circle-check {
    color: var(--status-good);
}

@media (max-width: 640px) {
    .checkup-score {
        flex-wrap: wrap;
        gap: var(--space-4);
    }

    /* The summary keeps a readable width; the button moves under it */
    .checkup-score-text {
        flex-basis: 200px;
    }
}

/* ── Discord AutoMod (Auto-Mod page) ───────────────────────────────────────── */
.dam-editor {
    padding: var(--pad-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.dam-editor h4 {
    margin: 0;
}

/* A hint stands off its box as in every other form (here it touched it), and a switch beside a labeled box is
   on the box's line, not on its label's */
.dam-editor .form-group small {
    margin-top: var(--space-hint);
    font-size: 0.78rem;
}

.dam-editor .field-grid:has(> .form-group:not(.module-field-bool)) > .module-field-bool {
    margin-top: calc(var(--space-6) + var(--space-1));
}


.dam-add .settings-select {
    width: auto;
    min-width: min(280px, 100%);   /* never wider than its card on a phone */
}

/* ── Backups ───────────────────────────────────────────────────────────────── */
/* The backups removed in the last day, under the list they left */
.bk-held-title {
    margin: var(--space-4) 0 var(--space-2);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.bk-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.bk-status-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bk-status-text p,
.bk-group h4 {
    margin: 0;
}

.bk-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.bk-change {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--gap-icon);
}

.bk-change.is-removed i { color: var(--status-critical); }
.bk-change.is-added i { color: var(--status-good); }
.bk-change.is-changed i { color: var(--status-warning); }

.bk-modes {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    border: 0;
}

.bk-modes legend {
    margin-bottom: var(--space-2);
    font-weight: 600;
}

.bk-modes label {
    display: flex;
    align-items: flex-start;
    gap: var(--gap-icon);
    cursor: pointer;
}

.bk-modes label > span {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.bk-details dt {
    color: var(--text-muted);
}

.bk-details dd {
    margin: 0;
}

.bk-log ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: var(--space-2) 0 0;
    padding-left: var(--space-5);
}

/* ── Templates: starter tiles, the save and code forms, a share code ───────── */
.tpl-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: var(--space-4);
}

/* (a share code's box, further down, is the same tile) */
.tpl-tile,
.tpl-code {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--pad-tile);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.tpl-tile h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
}

.tpl-tile p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
}

.tpl-tile .cell-actions {
    padding-top: var(--space-2);
}

/* (the counts sit level across the tiles, above the buttons, whatever the length of the description) */
.tpl-tile .tpl-counts {
    margin-top: auto;
}

.tpl-counts {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* The two forms share the card's width (auto-fill kept an empty third column beside them) */
.tpl-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: var(--space-4);
}

.tpl-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: 0.85rem;
}

/* (a field's label as on every other page: .form-group > label) */
.tpl-form label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tpl-row {
    display: flex;
    gap: var(--gap-row);
}

.tpl-row .settings-input {
    flex: 1;
    min-width: 0;
}

.tpl-code p {
    margin: 0;
    font-size: 0.85rem;
}

/* (no room under the last line: a long code scrolls in the box, and in that room half of its next line showed) */
.tpl-code textarea {
    padding-bottom: 0;
    resize: vertical;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .bk-details {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Find anything (search.js): the button in the top bar, and the box it opens */
.nav-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 34px;       /* as tall as the server picker and the account button beside it (their 24px mark + padding) */
    padding: var(--space-1) var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.nav-search:hover,
.nav-search:focus-visible {
    border-color: var(--primary);
    color: var(--text-main);
}

.nav-search-key {
    padding: 0 var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font: inherit;
    font-size: 0.72rem;
}

/* (near the top of the window, where a search box is looked for, not in its middle as a question is) */
.search-dialog {
    align-items: flex-start;
}

.search-dialog .modal-content {
    width: 560px;
    max-width: calc(100vw - 32px);
    margin-top: 12vh;
    padding: var(--space-3);
    gap: var(--space-2);
}

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

.search-result {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: 6px;
    color: var(--text-normal);
    cursor: pointer;
}

.search-result[aria-selected="true"] {
    background: var(--bg-tertiary);
    color: var(--text-main);
}

.search-result > i {
    width: 1.1em;
    color: var(--text-muted);
}

.search-result-name {
    min-width: 0;
    font-weight: 600;
}

/* (where it is: cut short before it pushes the name out of its row) */
.search-result-where {
    flex-shrink: 0;
    max-width: 55%;
    margin-left: auto;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-note {
    margin: 0;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .nav-search-key {
        display: none;
    }

    /* The word leaves the picture but stays the button's name for a screen reader (as .visually-hidden does):
       the button has no label of its own, so that its name is the words it shows */
    .nav-search-text {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* (the icon alone: as large as the menu button at the other end of the bar, for a finger) */
    .nav-search {
        justify-content: center;
        width: var(--control-height);
        height: var(--control-height);
        padding: 0;
    }
}

/* Another language's longer words (web/js/i18n.js): a feature's name in the Features list goes onto a second line
   instead of being cut, and a table's column titles may take two lines where one would push the table wider than
   its card (French, 2026-10-27). English, which the lines above were measured for, keeps its one line */
:root:not(:lang(en)) .mod-rail-name {
    white-space: normal;
    overflow-wrap: anywhere;
}

:root:not(:lang(en)) .data-table th {
    white-space: normal;
    vertical-align: bottom;
}

/* A line of commands joined the language's own way ("/coinflip、/roll、/8ball" in Japanese) holds no place a line may
   break: on a phone it breaks where it would run out of its box. (break-word, not anywhere: no box gets narrower) */
:root:not(:lang(en)) :is(p, li) {
    overflow-wrap: break-word;
}

/* One long word in a narrow label, term or value ("Sicherheitsereignisse" beside its switch, "Beobachtungsliste",
   "Assistance" in a column of figures) is hyphenated where the browser knows the language's words, and only
   words of ten letters or more; where it doesn't, the word breaks rather than leave its box. */
:root:not(:lang(en)) :is(label, dt, dd, .sec-prot-label) {
    overflow-wrap: anywhere;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
}
