/*
 * TecXCord — the Discord-like area (Direct Messages + Groups + Voice).
 *
 * Two families of styles:
 *   1. The LANDING two-pane shell (.gtx-cord--shell): a dark left rail with the DM +
 *      group lists and a placeholder main pane.
 *   2. The THREAD re-skin (.gtx-cord on the DM/group room): a dark, channel-style
 *      header (# for groups, @ for DMs, avatar + presence dot placeholder) and a DM
 *      sidebar. The chat column, bubbles, composer, pickers and voice panel are all
 *      reused from messages.css / groups.css — this file only adds the "cord" chrome.
 *
 * Tokens only, theme-aware (dark + light) via the shared --gtx-* variables.
 */

/* ===== Landing two-pane shell ============================================= */
.gtx-cord--shell {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    gap: var(--gtx-s4);
    align-items: stretch;
    height: calc(100vh - 60px - var(--gtx-s6) - var(--gtx-s8));
    min-height: 32rem;
}

.gtx-cord__rail {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s5);
    padding: var(--gtx-s4);
    overflow-y: auto;
    border: 1px solid var(--gtx-line);
    border-radius: var(--gtx-r-l);
    background: var(--gtx-chrome);
}

.gtx-cord__brand {
    padding: var(--gtx-s1) var(--gtx-s2) var(--gtx-s3);
    border-bottom: 1px solid var(--gtx-line);
    margin-bottom: var(--gtx-s2);
}

.gtx-cord__section {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s2);
}

.gtx-cord__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gtx-s2);
}

.gtx-cord__section-title {
    margin: 0;
    font-size: var(--gtx-fs-meta);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gtx-text-dim);
}

.gtx-cord__add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--gtx-r-s);
    color: var(--gtx-text-dim);
    text-decoration: none;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord__add:hover {
    background: var(--gtx-surface-hover);
    color: var(--gtx-text);
}

.gtx-cord__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gtx-cord__item {
    display: flex;
    align-items: center;
    gap: var(--gtx-s2);
    padding: var(--gtx-s2);
    border-radius: var(--gtx-r-m);
    color: var(--gtx-text-dim);
    text-decoration: none;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord__item:hover {
    background: var(--gtx-surface-hover);
    color: var(--gtx-text);
}

.gtx-cord__item.is-unread {
    color: var(--gtx-text);
}

.gtx-cord__item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.gtx-cord__item-name {
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gtx-cord__item.is-unread .gtx-cord__item-name {
    font-weight: 700;
}

.gtx-cord__item-preview {
    font-size: var(--gtx-fs-meta);
    color: var(--gtx-text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gtx-cord__badge {
    flex: 0 0 auto;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.35rem;
    border-radius: var(--gtx-r-full);
    background: var(--gtx-danger, #f87171);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}

.gtx-cord__empty {
    margin: 0;
    padding: var(--gtx-s2);
}

.gtx-cord__main {
    min-width: 0;
    border: 1px solid var(--gtx-line);
    border-radius: var(--gtx-r-l);
    background:
        radial-gradient(60% 60% at 100% 0%, var(--gtx-accent-soft) 0%, transparent 60%),
        var(--gtx-surface);
}

.gtx-cord__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Channel-name glyphs (Discord's # for a channel/group, @ for a DM). */
.gtx-cord__hash,
.gtx-cord__at {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--gtx-text-dim);
    font-size: 1.1rem;
}

/* ===== Thread re-skin (DM + group rooms) ================================== */
/* A darker, channel-style header on top of the reused .gtx-chat__head. */
.gtx-cord__head {
    background: var(--gtx-surface-2, var(--gtx-chrome));
}

/* Avatar with a presence-dot placeholder overlaid bottom-right (Wave 1: static). */
.gtx-cord__avatar {
    position: relative;
    overflow: visible;
}

.gtx-cord__presence {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: var(--gtx-r-full);
    background: var(--gtx-idle, #9ca3af);
    border: 2px solid var(--gtx-chrome);
}

/* DM sidebar peer card (mirrors the group member list styling). */
.gtx-cord__peer {
    display: flex;
    align-items: center;
    gap: var(--gtx-s2);
}

.gtx-cord__peer-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--gtx-text);
}

@media (max-width: 48rem) {
    .gtx-cord--shell {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    /* On narrow viewports the placeholder pane is noise — the rail is the screen. */
    .gtx-cord__placeholder {
        display: none;
    }
}

/* =========================================================================
 * DISCORD-STYLE OVERHAUL (Wave C — visual/UX pass)
 *
 * Everything below is scoped to `.gtx-cord`. A local dark palette (`--cord-*`) is
 * defined once and mapped onto the shared `--gtx-*` tokens the reused chat / channel /
 * composer components already consume — so the whole area re-skins to a deep desaturated
 * blue-grey scheme WITHOUT touching those component files, and the overrides can never
 * leak past `.gtx-cord` (custom properties only cascade to descendants). The area is
 * dark regardless of the app theme; light mode elsewhere is untouched.
 * ========================================================================= */

.gtx-cord {
    /* Local Discord-like palette — three column tones + a bright accent. */
    --cord-rail: #16171b;        /* server rail — darkest */
    --cord-column: #1c1d22;      /* channel list + member sidebar */
    --cord-chat: #24262c;        /* main message area — lightest */
    --cord-input: #2b2d34;       /* composer input, pickers, chips */
    --cord-line: #34363d;
    --cord-hover: #2c2e35;
    --cord-text: #c7ccd4;
    --cord-text-dim: #8a919c;
    --cord-text-bright: #f2f3f5;
    --cord-accent: #7c5cff;      /* GameTecX violet: active / mention / link */
    --cord-accent-soft: rgba(124, 92, 255, 0.18);
    --cord-online: #3ba55d;
    --cord-idle: #80848e;

    /* Re-map the tokens the reused components read. */
    --gtx-bg: var(--cord-chat);
    --gtx-chrome: var(--cord-column);
    --gtx-surface: var(--cord-chat);
    --gtx-surface-2: var(--cord-input);
    --gtx-surface-hover: var(--cord-hover);
    --gtx-line: var(--cord-line);
    --gtx-line-strong: #43464f;
    --gtx-text: var(--cord-text-bright);
    --gtx-text-dim: var(--cord-text-dim);
    --gtx-accent: var(--cord-accent);
    --gtx-accent-hover: #6b4ef0;
    --gtx-accent-fill: var(--cord-accent);
    --gtx-accent-fill-hover: #6b4ef0;
    --gtx-accent-soft: var(--cord-accent-soft);
    --gtx-on-accent: #ffffff;
    --gtx-ok: var(--cord-online);
    --gtx-idle: var(--cord-idle);

    color: var(--cord-text);
    color-scheme: dark;
}

/* ----- Room grids: add the 4.5rem server rail as the first column ---------- */
.gtx-grouproom--server.gtx-cord {
    grid-template-columns: 4.5rem 15rem minmax(0, 1fr) 16rem;
}

.gtx-grouproom--dm.gtx-cord {
    grid-template-columns: 4.5rem minmax(0, 1fr) 16rem;
}

/* ----- Server rail (far left) --------------------------------------------- */
.gtx-cordrail {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gtx-s2);
    width: 100%;
    padding: var(--gtx-s2) 0;
    background: var(--cord-rail);
    border-radius: var(--gtx-r-l);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.gtx-cordrail::-webkit-scrollbar {
    display: none;
}

.gtx-cordrail__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gtx-s2);
    width: 100%;
}

.gtx-cordrail__sep {
    width: 2rem;
    height: 2px;
    border-radius: 1px;
    background: var(--cord-line);
    flex: 0 0 auto;
}

.gtx-cordrail__pill {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-decoration: none;
    color: var(--cord-text);
}

/* The left-edge indicator pill (hidden → hover pip → tall on active). */
.gtx-cordrail__indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    border-radius: 0 4px 4px 0;
    background: var(--cord-text-bright);
    transition: height var(--gtx-t-med) var(--gtx-ease);
}

.gtx-cordrail__pill:hover .gtx-cordrail__indicator {
    height: 20px;
}

.gtx-cordrail__pill.is-active .gtx-cordrail__indicator {
    height: 40px;
}

/* The round badge (icon or server avatar). A rounded square that morphs to a circle
   on hover / active — the signature server-rail interaction. */
.gtx-cordrail__badge,
.gtx-avatar.gtx-cordrail__badge {
    width: 48px;
    height: 48px;
    border-radius: 34%;
    background: var(--cord-column);
    color: var(--cord-text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-radius var(--gtx-t-med) var(--gtx-ease), background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cordrail__pill:hover .gtx-cordrail__badge,
.gtx-cordrail__pill.is-active .gtx-cordrail__badge {
    border-radius: 50%;
}

.gtx-cordrail__pill.is-active .gtx-cordrail__badge {
    background: var(--cord-accent);
    color: #fff;
}

.gtx-cordrail__home:hover .gtx-cordrail__badge,
.gtx-cordrail__home.is-active .gtx-cordrail__badge {
    background: var(--cord-accent);
    color: #fff;
}

/* The create-server "＋" is green (a friendly, distinct affordance). */
.gtx-cordrail__add .gtx-cordrail__badge {
    color: var(--cord-online);
}

.gtx-cordrail__add:hover .gtx-cordrail__badge {
    background: var(--cord-online);
    color: #fff;
}

/* ----- Column surfaces: channel list + member sidebar are the mid tone ----- */
.gtx-cord .gtx-grouproom__channels,
.gtx-cord .gtx-grouproom__side {
    background: var(--cord-column);
    border-color: var(--cord-line);
}

/* The channel header sits flush with the chat tone, lifted by a hairline shadow. */
.gtx-cord .gtx-cord__head {
    background: var(--cord-chat);
    border-bottom-color: var(--cord-line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Active text/voice channel gets the accent tint (Discord's selected channel). */
.gtx-cord .gtx-channels__item.is-active {
    background: var(--cord-accent-soft);
    color: var(--cord-text-bright);
}

/* ----- Message rows (replaces the WhatsApp bubble look) -------------------- */
.gtx-cord .gtx-chat__log {
    gap: 0;
    padding: var(--gtx-s3) 0 var(--gtx-s4);
    background: var(--cord-chat);
}

/* Neutralise every bubble treatment inherited from messages.css and lay the message
   out as a row: avatar gutter + content. Applies to mine AND theirs alike. */
.gtx-cord .gtx-cordmsg {
    position: relative;
    display: flex;
    gap: var(--gtx-s3);
    align-self: stretch;
    max-width: none;
    margin: 0;
    padding: 2px var(--gtx-s4);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--cord-text);
}

.gtx-cord .gtx-cordmsg:not(.gtx-msg--grouped) {
    margin-top: var(--gtx-s4);
}

.gtx-cord .gtx-chat__log > .gtx-cordmsg:first-child {
    margin-top: 0;
}

.gtx-cord .gtx-cordmsg.gtx-msg--grouped {
    margin-top: 0;
    border-radius: 0;
}

.gtx-cord .gtx-cordmsg:hover {
    background: rgba(0, 0, 0, 0.16);
}

.gtx-cordmsg__aside {
    flex: 0 0 auto;
    width: 40px;
    display: flex;
    justify-content: center;
}

.gtx-avatar.gtx-cordmsg__avatar {
    width: 40px;
    height: 40px;
    margin-top: 2px;
}

/* Continuation rows: a compact timestamp in the gutter, revealed on row hover. */
.gtx-cordmsg__ts {
    font-size: 10px;
    color: var(--cord-text-dim);
    line-height: 1.5rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-cordmsg.gtx-msg--grouped:hover .gtx-cordmsg__ts {
    opacity: 1;
}

.gtx-cordmsg__content {
    flex: 1 1 auto;
    min-width: 0;
}

.gtx-cordmsg__head {
    display: flex;
    align-items: baseline;
    gap: var(--gtx-s2);
    line-height: 1.4;
}

.gtx-cordmsg__author {
    font-weight: 600;
    color: var(--cord-text-bright);
    font-size: 0.95rem;
}

.gtx-cordmsg__time {
    font-size: 11px;
    color: var(--cord-text-dim);
}

.gtx-cord .gtx-cordmsg .gtx-msg__body {
    color: var(--cord-text);
    line-height: 1.4;
}

.gtx-cord .gtx-cordmsg .gtx-msg__media {
    margin-top: var(--gtx-s1);
}

/* Reactions always align left in a row layout (not flushed right for "mine"). */
.gtx-cord .gtx-msg__reactions,
.gtx-cord .gtx-msg--mine .gtx-msg__reactions {
    justify-content: flex-start;
}

.gtx-cord .gtx-cordmsg .gtx-msg__reactions:not(:empty) {
    margin-top: 4px;
}

/* @mention keeps the accent look on the viewer's own rows too (no white-on-fill). */
.gtx-cord .gtx-msg--mine .gtx-mention {
    color: var(--cord-accent);
    background: var(--cord-accent-soft);
}

/* The hover "＋" react control: a top-right action affordance on the row. */
.gtx-cord .gtx-react-add {
    top: -10px;
    right: var(--gtx-s4);
}

/* ----- Composer: filled rounded input, flat chat-toned bar ----------------- */
.gtx-cord .gtx-composer {
    background: var(--cord-chat);
    border-top: 0;
    padding-bottom: var(--gtx-s4);
}

.gtx-cord .gtx-composer__input {
    background: var(--cord-input);
    border-color: transparent;
}

.gtx-cord .gtx-composer__file,
.gtx-cord .gtx-chat__typing {
    background: var(--cord-chat);
}

/* ----- Member sidebar: Online / Offline sections --------------------------- */
.gtx-cordmembers {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s4);
}

.gtx-cordmembers__section {
    display: flex;
    flex-direction: column;
}

.gtx-cordmembers__title {
    margin: 0 0 var(--gtx-s2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--cord-text-dim);
}

.gtx-cordmember__name {
    color: var(--cord-text);
    font-weight: 500;
}

/* Offline members read back (dimmed avatar + muted name) — Discord convention. */
.gtx-cordmember.is-offline .gtx-avatar {
    opacity: 0.45;
}

.gtx-cordmember.is-offline .gtx-cordmember__name {
    color: var(--cord-text-dim);
}

/* Hook for a later wave: per-role name colours attach to .gtx-cordmember--role-*. */

/* =========================================================================
 * WAVE D1 — markdown, replies, edit, delete, hover action toolbar
 * ========================================================================= */

/* ----- Safe markdown subset (server + live render share these classes) ----- */
.gtx-cord .gtx-msg__body code.gtx-md-code {
    padding: 0.1em 0.35em;
    border-radius: var(--gtx-r-s);
    background: rgba(0, 0, 0, 0.28);
    font-family: var(--gtx-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 0.9em;
}

.gtx-cord .gtx-msg__body pre.gtx-md-pre {
    margin: var(--gtx-s1) 0;
    padding: var(--gtx-s2) var(--gtx-s3);
    border-radius: var(--gtx-r-m);
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--cord-line);
    overflow-x: auto;
}

.gtx-cord .gtx-msg__body pre.gtx-md-pre code {
    font-family: var(--gtx-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 0.9em;
    white-space: pre;
}

.gtx-cord .gtx-msg__body blockquote.gtx-md-quote {
    display: block;
    margin: 1px 0;
    padding: 0 var(--gtx-s3);
    border-left: 3px solid var(--cord-line);
    color: var(--cord-text);
}

/* Spoiler: hidden until clicked / focused (keyboard-accessible via role+tabindex). */
.gtx-cord .gtx-md-spoiler {
    border-radius: var(--gtx-r-s);
    background: #0f0f12;
    color: transparent;
    cursor: pointer;
    transition: color var(--gtx-t-fast) var(--gtx-ease), background var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-md-spoiler.is-revealed {
    background: rgba(0, 0, 0, 0.28);
    color: inherit;
    cursor: auto;
}

/* ----- Reply reference (quoted parent above a message) --------------------- */
.gtx-cordmsg__reply {
    display: flex;
    align-items: center;
    gap: var(--gtx-s1);
    max-width: 100%;
    margin: 0 0 2px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cord-text-dim);
    font-size: 0.8rem;
    line-height: 1.3;
    cursor: pointer;
    text-align: left;
}

.gtx-cordmsg__reply:hover .gtx-cordmsg__reply-snippet,
.gtx-cordmsg__reply:hover .gtx-cordmsg__reply-author {
    color: var(--cord-text-bright);
}

.gtx-cordmsg__reply-arrow {
    flex: 0 0 auto;
    color: var(--cord-text-dim);
}

.gtx-cordmsg__reply-author {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--cord-accent);
}

.gtx-cordmsg__reply-snippet {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- "(bearbeitet)" marker ---------------------------------------------- */
.gtx-cordmsg__edited {
    margin-left: 0.25em;
    font-size: 0.68rem;
    color: var(--cord-text-dim);
    user-select: none;
}

/* ----- Hover action toolbar (top-right of the row) ------------------------- */
.gtx-msg__toolbar {
    position: absolute;
    top: -12px;
    right: var(--gtx-s3);
    display: none;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--cord-line);
    border-radius: var(--gtx-r-m);
    background: var(--cord-input);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    z-index: 3;
}

.gtx-cord .gtx-cordmsg:hover .gtx-msg__toolbar,
.gtx-cord .gtx-cordmsg:focus-within .gtx-msg__toolbar {
    display: flex;
}

.gtx-msg__act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: var(--gtx-r-s);
    background: none;
    color: var(--cord-text-dim);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-msg__act:hover {
    background: var(--cord-hover);
    color: var(--cord-text-bright);
}

.gtx-msg__act--delete:hover {
    color: var(--gtx-danger, #f87171);
}

/* The C1 floating "＋" is superseded by the toolbar's React action in the cord look. */
.gtx-cord .gtx-react-add {
    display: none;
}

/* The quick-emoji popover the toolbar React button opens (anchored to the toolbar). */
.gtx-msg__react-pop {
    position: absolute;
    top: 100%;
    right: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 14rem;
    margin-top: 2px;
    padding: var(--gtx-s1);
    border: 1px solid var(--cord-line);
    border-radius: var(--gtx-r-m);
    background: var(--cord-input);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 4;
}

/* Briefly highlight a message jumped to via its reply reference. */
.gtx-cord .gtx-cordmsg.is-flash {
    background: var(--cord-accent-soft);
    transition: background var(--gtx-t-med) var(--gtx-ease);
}

/* ----- Composer: reply banner + inline message editor ---------------------- */
.gtx-composer__reply {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gtx-s2);
    margin: 0 var(--gtx-s4);
    padding: var(--gtx-s2) var(--gtx-s3);
    border-radius: var(--gtx-r-m) var(--gtx-r-m) 0 0;
    background: var(--cord-input);
    color: var(--cord-text-dim);
    font-size: 0.85rem;
}

.gtx-composer__reply-label {
    display: flex;
    align-items: center;
    gap: var(--gtx-s1);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gtx-composer__reply-arrow {
    color: var(--cord-accent);
}

.gtx-composer__reply-clear {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: var(--cord-text-dim);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.gtx-composer__reply-clear:hover {
    color: var(--cord-text-bright);
}

.gtx-msg__editor {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s1);
    margin: 2px 0;
}

.gtx-msg__editor-input {
    width: 100%;
    min-height: 2.5rem;
    resize: vertical;
}

.gtx-msg__editor-actions {
    display: flex;
    gap: var(--gtx-s2);
}

/* ----- TecXCord wordmark (original mark + text) ---------------------------- */
.gtx-cordmark {
    display: inline-flex;
    align-items: center;
    gap: var(--gtx-s2);
    font-family: var(--gtx-font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--cord-text-bright);
    text-decoration: none;
}

.gtx-cordmark__glyph {
    color: var(--cord-accent);
    flex: 0 0 auto;
}

.gtx-cordmark__name b {
    color: var(--cord-accent);
    font-weight: 700;
}

/* =========================================================================
 * VOICE PANEL (chat-app style: join button, connecting state, round-icon control
 * bar, and participant chips with a green speaking ring).
 *
 * Scoped to `.gtx-cord`, local `--cord-*` tokens only. Presentation only — the mesh
 * signaling + the (local, optional) speaking meter live in public/js/mesh-voice.js.
 * ========================================================================= */

/* Idle Join: phone glyph + label on one line. */
.gtx-cord .gtx-voice__join {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gtx-s2);
}

.gtx-cord .gtx-voice__join.is-connecting {
    opacity: 0.75;
    cursor: progress;
}

/* Participant chips: avatar + name + meta laid out as a row. */
.gtx-cord .gtx-vchip {
    display: flex;
    align-items: center;
    gap: var(--gtx-s2);
    padding: var(--gtx-s1) var(--gtx-s2);
    border-radius: var(--gtx-r-m);
    font-size: 0.9rem;
    color: var(--cord-text);
}

.gtx-cord .gtx-vchip:hover {
    background: var(--cord-hover);
}

.gtx-cord .gtx-vchip__avatar {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--cord-input);
    color: var(--cord-text-dim);
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 0 0 0 transparent;
    transition: box-shadow var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-vchip__img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.gtx-cord .gtx-vchip__initial {
    line-height: 1;
}

/* Speaking ring — a green outline pulse while that participant talks (JS toggles the
   class off a purely local WebAudio meter). */
.gtx-cord .gtx-vchip.is-speaking .gtx-vchip__avatar {
    box-shadow: 0 0 0 2px var(--cord-online);
    animation: gtx-voice-pulse 1.1s ease-out infinite;
}

@keyframes gtx-voice-pulse {
    0% { box-shadow: 0 0 0 2px var(--cord-online), 0 0 0 0 rgba(59, 165, 93, 0.5); }
    70% { box-shadow: 0 0 0 2px var(--cord-online), 0 0 0 6px rgba(59, 165, 93, 0); }
    100% { box-shadow: 0 0 0 2px var(--cord-online), 0 0 0 0 rgba(59, 165, 93, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .gtx-cord .gtx-vchip.is-speaking .gtx-vchip__avatar {
        animation: none;
    }
}

/* Mute badge on the chip avatar (a small mic-off pip, bottom-right). */
.gtx-cord .gtx-vchip__badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--cord-column);
    color: var(--gtx-danger, #f87171);
}

.gtx-cord .gtx-vchip__badge[hidden] {
    display: none;
}

.gtx-cord .gtx-vchip__badge-icon {
    width: 0.7rem;
    height: 0.7rem;
}

.gtx-cord .gtx-vchip__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gtx-cord .gtx-vchip.is-pending .gtx-vchip__name {
    color: var(--cord-text-dim);
}

.gtx-cord .gtx-vchip__meta {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--cord-text-dim);
}

.gtx-cord .gtx-vchip__meta:empty {
    display: none;
}

/* Control bar: round icon buttons, centred. */
.gtx-cord .gtx-voice__bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--gtx-s3);
    margin-top: var(--gtx-s3);
}

.gtx-cord .gtx-vbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--cord-input);
    color: var(--cord-text-bright);
    cursor: pointer;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-vbtn:hover {
    background: var(--cord-hover);
}

.gtx-cord .gtx-vbtn:focus-visible {
    outline: 2px solid var(--cord-accent);
    outline-offset: 2px;
}

/* Toggled-on state (muted mic / deafened output) reads as active/danger. */
.gtx-cord .gtx-vbtn.is-muted,
.gtx-cord .gtx-vbtn.is-active {
    background: var(--gtx-danger, #f87171);
    color: #fff;
}

/* Hang-up / leave is always the red action. */
.gtx-cord .gtx-vbtn--leave {
    background: var(--gtx-danger, #f87171);
    color: #fff;
}

.gtx-cord .gtx-vbtn--leave:hover {
    background: #e2574f;
}

/* ----- Responsive ---------------------------------------------------------- */
@media (max-width: 64rem) {
    .gtx-grouproom--server.gtx-cord {
        grid-template-columns: 4.5rem 13rem minmax(0, 1fr);
    }
}

@media (max-width: 48rem) {
    .gtx-grouproom--server.gtx-cord,
    .gtx-grouproom--dm.gtx-cord {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The rail becomes a horizontal strip above the columns on mobile. */
    .gtx-cordrail {
        align-self: auto;
        flex-direction: row;
        width: 100%;
        padding: var(--gtx-s2);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .gtx-cordrail__list {
        flex-direction: row;
        width: auto;
    }

    .gtx-cordrail__sep {
        width: 2px;
        height: 2rem;
    }

    .gtx-cordrail__indicator {
        left: 50%;
        top: auto;
        bottom: 0;
        transform: translateX(-50%);
        width: 0;
        height: 4px;
        border-radius: 4px 4px 0 0;
    }

    .gtx-cordrail__pill:hover .gtx-cordrail__indicator {
        width: 20px;
        height: 4px;
    }

    .gtx-cordrail__pill.is-active .gtx-cordrail__indicator {
        width: 32px;
        height: 4px;
    }
}

/* ============================================================================
   TecXCord Wave D3 — unread indicators (server rail + channel list) themed to
   the cord palette, and the collapsible category header.
   ========================================================================== */

/* Server-rail unread dot: a small bright pip at the badge's lower-right (shown
   only on non-active servers with an unread visible channel, and on the home pill
   for unread DMs). */
.gtx-cordrail__unread {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cord-text-bright, #fff);
    border: 2px solid var(--cord-column, #2b2d31);
    pointer-events: none;
}

/* Channel-list unread: bold + a bright dot, using the cord text tone. */
.gtx-cord .gtx-channels__item.is-unread .gtx-channels__name {
    color: var(--cord-text-bright, #fff);
    font-weight: 700;
}

.gtx-cord .gtx-channels__unread {
    background: var(--cord-text-bright, #fff);
}

/* Category header tones in the cord column. */
.gtx-cord .gtx-channels__cat-toggle {
    color: var(--cord-text-dim);
}

.gtx-cord .gtx-channels__cat-toggle:hover {
    color: var(--cord-text-bright, #fff);
}

/* =========================================================================
 * WAVE C-UI — deep interaction + visual pass.
 *
 * Two groups of rules:
 *   1. FLOATING UI (context menu / user popout / tooltip / settings modal) — these are
 *      appended to <body>, OUTSIDE the `.gtx-cord` custom-property scope, so they carry a
 *      small self-contained dark surface palette (`--cordui-*`) instead of `--cord-*`.
 *   2. IN-SCOPE POLISH — refinements scoped to `.gtx-cord` (member/gear affordances, slim
 *      scrollbars, focus rings) that lean on the existing `--cord-*` tokens.
 * ========================================================================= */

:root {
    --cordui-surface: #1c1d22;
    --cordui-raised: #2b2d34;
    --cordui-line: #34363d;
    --cordui-hover: #2c2e35;
    --cordui-text: #f2f3f5;
    --cordui-text-dim: #8a919c;
    --cordui-accent: #7c5cff;
    --cordui-online: #3ba55d;
    --cordui-danger: #f87171;
}

/* ----- Context menu (right-click message / channel / member) --------------- */
.gtx-cord-menu {
    min-width: 12rem;
    max-width: 18rem;
    padding: 6px;
    border: 1px solid var(--cordui-line);
    border-radius: 8px;
    background: var(--cordui-surface);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gtx-cord-menu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--cordui-text);
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.2;
    cursor: pointer;
}

.gtx-cord-menu__item:hover,
.gtx-cord-menu__item:focus-visible {
    background: var(--cordui-accent);
    color: #fff;
    outline: none;
}

.gtx-cord-menu__item.is-danger {
    color: var(--cordui-danger);
}

.gtx-cord-menu__item.is-danger:hover,
.gtx-cord-menu__item.is-danger:focus-visible {
    background: var(--cordui-danger);
    color: #fff;
}

.gtx-cord-menu__item:disabled {
    opacity: 0.4;
    cursor: default;
}

.gtx-cord-menu__sep {
    height: 1px;
    margin: 4px 6px;
    background: var(--cordui-line);
}

/* ----- Popover + user popout card ----------------------------------------- */
.gtx-cord-popover {
    z-index: 1200;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.gtx-cord-popout {
    width: 17rem;
    max-width: calc(100vw - 24px);
    padding: 14px;
    border: 1px solid var(--cordui-line);
    border-radius: 10px;
    background: var(--cordui-surface);
    color: var(--cordui-text);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gtx-cord-popout__head {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.gtx-avatar.gtx-cord-popout__avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
}

.gtx-cord-popout__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gtx-cord-popout__name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--cordui-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gtx-cord-popout__status {
    font-size: 0.8rem;
    color: var(--cordui-text-dim);
}

.gtx-cord-popout__status.is-online {
    color: var(--cordui-online);
}

.gtx-cord-popout__roles {
    border-top: 1px solid var(--cordui-line);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gtx-cord-popout__roles-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--cordui-text-dim);
}

.gtx-cord-popout__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gtx-cord-popout__actions .gtx-btn {
    flex: 1 1 auto;
    justify-content: center;
}

/* ----- Tooltip ------------------------------------------------------------ */
.gtx-cord-tip {
    z-index: 1300;
    padding: 5px 9px;
    border-radius: 6px;
    background: #0f0f12;
    color: #f2f3f5;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    white-space: nowrap;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- Settings MODAL (wide) + settings-nav layout ------------------------ */
.gtx-modal.gtx-modal--settings {
    max-width: 60rem;
    background: #24262c;
    color: #f2f3f5;
    border-color: var(--cordui-line);
}

.gtx-modal--settings .gtx-modal__body > * + * {
    margin-top: 0;
}

.gtx-modal--settings .gtx-settings {
    margin: 0;
}

/* Settings-nav: stacked (works with NO JS); a two-column tab layout once enhanced. */
.gtx-settings__layout {
    display: block;
}

.gtx-settings__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--gtx-s4);
}

.gtx-settings__nav-item {
    padding: 6px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--gtx-text-dim);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-settings__nav-item:hover {
    background: var(--gtx-surface-hover);
    color: var(--gtx-text);
}

.gtx-settings__nav-item.is-active {
    background: var(--gtx-accent-soft);
    color: var(--gtx-text);
}

.gtx-settings__layout.is-tabbed {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: var(--gtx-s5);
    align-items: start;
}

.gtx-settings__layout.is-tabbed .gtx-settings__nav {
    flex-direction: column;
    margin-bottom: 0;
}

.gtx-settings__layout.is-tabbed .gtx-settings__nav-item {
    width: 100%;
    text-align: left;
}

.gtx-settings__panel > * + * {
    margin-top: var(--gtx-s4);
}

@media (max-width: 40rem) {
    .gtx-settings__layout.is-tabbed {
        grid-template-columns: minmax(0, 1fr);
    }

    .gtx-settings__layout.is-tabbed .gtx-settings__nav {
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: var(--gtx-s4);
    }
}

/* ----- In-scope polish ---------------------------------------------------- */
/* The server-header gear (opens settings — page fallback, or the modal with JS). */
.gtx-cord .gtx-grouproom__server-gear {
    flex: 0 0 auto;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 6px;
    color: var(--cord-text-dim);
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1;
    transition: background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-grouproom__server-gear:hover {
    background: var(--cord-hover);
    color: var(--cord-text-bright);
}

/* Member rows read as clickable (they open the user popout). The inline kick ✕ is quiet
   until row hover, so the sidebar stays calm — Discord-style. */
.gtx-cord .gtx-cordmember {
    cursor: pointer;
    border-radius: var(--gtx-r-s);
    padding: 2px 4px;
    transition: background var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-cordmember:hover {
    background: var(--cord-hover);
}

.gtx-cord .gtx-cordmember form {
    opacity: 0;
    transition: opacity var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-cord .gtx-cordmember:hover form,
.gtx-cord .gtx-cordmember:focus-within form {
    opacity: 1;
}

/* Slim, self-coloured scrollbars for the three scrolling cord columns. */
.gtx-cord .gtx-grouproom__channels,
.gtx-cord .gtx-grouproom__side,
.gtx-cord .gtx-chat__log {
    scrollbar-width: thin;
    scrollbar-color: var(--cord-line) transparent;
}

.gtx-cord .gtx-grouproom__channels::-webkit-scrollbar,
.gtx-cord .gtx-grouproom__side::-webkit-scrollbar,
.gtx-cord .gtx-chat__log::-webkit-scrollbar {
    width: 8px;
}

.gtx-cord .gtx-grouproom__channels::-webkit-scrollbar-thumb,
.gtx-cord .gtx-grouproom__side::-webkit-scrollbar-thumb,
.gtx-cord .gtx-chat__log::-webkit-scrollbar-thumb {
    background: var(--cord-line);
    border-radius: 4px;
}

.gtx-cord .gtx-grouproom__channels::-webkit-scrollbar-thumb:hover,
.gtx-cord .gtx-grouproom__side::-webkit-scrollbar-thumb:hover,
.gtx-cord .gtx-chat__log::-webkit-scrollbar-thumb:hover {
    background: var(--gtx-line-strong);
}

/* Consistent focus rings across the cord scope (keyboard users). */
.gtx-cord a:focus-visible,
.gtx-cord button:focus-visible,
.gtx-cord [tabindex]:focus-visible {
    outline: 2px solid var(--cord-accent);
    outline-offset: 2px;
    border-radius: var(--gtx-r-s);
}

/* =========================================================================
 * IMMERSIVE FULL-SCREEN SHELL (layouts/cord) — the whole TecXCord area.
 *
 * `.gtx-cord--app` owns the viewport (100vh, no scroll); the shared server rail is a
 * fixed far-left flex column and the page fills the rest with its own full-height
 * columns (DM list / channels / chat / members), each an independent scroll area. The
 * `.gtx-cord` scope (declared far above) already supplies the dark `--cord-*` palette, so
 * placing `.gtx-cord.gtx-cord--app` on the shell root themes the entire screen.
 * ========================================================================= */

.gtx-cord--app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--cord-chat);
    color: var(--cord-text);
}

/* Server rail: the fixed 4.5rem far-left flex column (was a grid cell in the old shell). */
.gtx-cord--app > .gtx-cordrail {
    flex: 0 0 4.5rem;
    width: 4.5rem;
    height: 100vh;
    align-self: auto;
    border-radius: 0;
    padding: var(--gtx-s3) 0;
}

/* Push the bottom user-area to the foot of the rail. */
.gtx-cordrail__user {
    margin-top: auto;
    width: 100%;
}

.gtx-cordrail__me {
    cursor: pointer;
}

/* The rail user popout escapes the rail's overflow by anchoring to the viewport, just to
   the right of the rail near its foot (a rail column is only 4.5rem wide). */
.gtx-cordrail__user .gtx-menu__panel.gtx-cordrail__menu {
    position: fixed;
    left: calc(4.5rem + 8px);
    bottom: 12px;
    top: auto;
    right: auto;
    min-width: 15rem;
    background: var(--cord-column);
    border-color: var(--cord-line);
    color: var(--cord-text);
}

/* The page area fills the remaining width; each variant lays out its own columns. */
.gtx-cordpage {
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.gtx-cordpage--server {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr) 16rem;
}

.gtx-cordpage--dm {
    display: grid;
    grid-template-columns: 20rem minmax(0, 1fr);
}

.gtx-cordpage--dmthread {
    display: grid;
    grid-template-columns: 20rem minmax(0, 1fr) 16rem;
}

/* Document-style pages (roles / settings): a single scrolling column, content centred. */
.gtx-cordpage--doc {
    display: block;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--cord-line) transparent;
}

/* Full-height columns with independent scroll (flatten the app-shell card sizing). */
.gtx-cord--app .gtx-chat {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
}

.gtx-cord--app .gtx-grouproom__channels,
.gtx-cord--app .gtx-grouproom__side {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    position: static;
    top: auto;
    border-radius: 0;
    border: 0;
}

.gtx-cord--app .gtx-grouproom__channels {
    border-right: 1px solid var(--cord-line);
}

.gtx-cord--app .gtx-grouproom__side {
    border-left: 1px solid var(--cord-line);
}

/* ----- DM conversation-list column (rail | DM-list | conversation) --------- */
.gtx-cord__dmcol {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    background: var(--cord-column);
    border-right: 1px solid var(--cord-line);
}

.gtx-cord__dmcol-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gtx-s2);
    flex: 0 0 auto;
    padding: var(--gtx-s3) var(--gtx-s4);
    border-bottom: 1px solid var(--cord-line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.gtx-cord__dmcol-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cord-text-bright);
}

.gtx-cord__dmcol-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--gtx-s2);
    scrollbar-width: thin;
    scrollbar-color: var(--cord-line) transparent;
}

/* The DM-list rows read as the mid column tone; active row gets the accent tint. */
.gtx-cord__dmcol .gtx-cord__item.is-active {
    background: var(--cord-accent-soft);
    color: var(--cord-text-bright);
}

/* ----- Main conversation pane (DM home empty-state) ------------------------ */
.gtx-cordmain {
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: var(--cord-chat);
}

.gtx-cordmain--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--gtx-s6);
}

.gtx-cordmain--empty .gtx-state__icon {
    color: var(--cord-accent);
    opacity: 0.8;
}

/* Slim scrollbars for the new scrolling columns (WebKit; matches the room columns). */
.gtx-cord__dmcol-scroll::-webkit-scrollbar,
.gtx-cordpage--doc::-webkit-scrollbar {
    width: 8px;
}

.gtx-cord__dmcol-scroll::-webkit-scrollbar-thumb,
.gtx-cordpage--doc::-webkit-scrollbar-thumb {
    background: var(--cord-line);
    border-radius: 4px;
}

/* ----- Responsive: narrow the columns, then drop the member sidebar -------- */
@media (max-width: 64rem) {
    .gtx-cordpage--server {
        grid-template-columns: 13rem minmax(0, 1fr) 14rem;
    }

    .gtx-cordpage--dm,
    .gtx-cordpage--dmthread {
        grid-template-columns: 16rem minmax(0, 1fr);
    }

    .gtx-cordpage--dmthread .gtx-grouproom__side {
        display: none;
    }
}

@media (max-width: 48rem) {
    .gtx-cordpage--server {
        grid-template-columns: 12rem minmax(0, 1fr);
    }

    .gtx-cordpage--server .gtx-grouproom__side {
        display: none;
    }

    .gtx-cordpage--dm,
    .gtx-cordpage--dmthread {
        grid-template-columns: 12rem minmax(0, 1fr);
    }
}

/* =========================================================================
 * CORD-FORMS — Discord-style create/manage MODALS + immersive form fields
 * (TecXCord cord-forms). Progressive: each modal group is a plain inline form
 * without JS; tecxcord-ui.js relocates it into a .gtx-modal--cord on a trigger.
 * ========================================================================= */

/* ----- Channel header TOPIC ("# name — topic") ---------------------------- */
.gtx-cord .gtx-chat__name {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.gtx-cord .gtx-chat__name-text {
    flex: 0 0 auto;
    font-weight: 600;
}

.gtx-cord .gtx-cord__topic-sep {
    flex: 0 0 auto;
    color: var(--cord-line);
}

.gtx-cord .gtx-cord__topic {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--cord-text-dim);
}

/* ----- Channel-management toolbar (bottom of the channel list) ------------ */
.gtx-cordmanage {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s2);
    margin-top: var(--gtx-s2);
    padding-top: var(--gtx-s2);
    border-top: 1px solid var(--cord-line);
}

.gtx-cordmanage__trigger {
    justify-content: flex-start;
    gap: 0.45rem;
}

.gtx-cordmanage__gear {
    font-size: 1rem;
    line-height: 1;
}

/* When JS is present the inline body is hidden and only the trigger shows; without
   JS the trigger stays [hidden] and the body renders as a plain stacked form. */
.gtx-cordform__body {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s3);
}

/* Inline (no-JS) fallback body sits in a quiet panel so it reads as a group. */
.gtx-cordmanage .gtx-cordform__body {
    padding: var(--gtx-s3);
    border-radius: var(--gtx-r-m);
    background: var(--cord-chat);
    border: 1px solid var(--cord-line);
}

.gtx-cordform__form {
    display: flex;
    flex-direction: column;
    gap: var(--gtx-s3);
}

/* Two forms stacked inside one edit modal get a divider between them. */
.gtx-cordform__form + .gtx-cordform__form {
    padding-top: var(--gtx-s3);
    border-top: 1px solid var(--gtx-line);
}

.gtx-cordform__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--gtx-s2);
}

.gtx-cordform__form--access .gtx-check-group {
    margin-top: var(--gtx-s1);
}

/* ----- Segmented control (channel type: text / voice) --------------------- */
/* The <legend> spans the row; the two radio options sit side by side beneath it.
   Radios are visually hidden — the styled box IS the control. */
.gtx-segmented {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gtx-s2);
}

.gtx-segmented .gtx-field__label {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.gtx-segmented__opt {
    position: relative;
    display: flex;
    min-width: 0;
}

.gtx-segmented__opt input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.gtx-segmented__box {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gtx-line);
    border-radius: var(--gtx-r-m);
    background: var(--cord-column, var(--gtx-surface));
    color: var(--gtx-text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--gtx-t-fast) var(--gtx-ease), background var(--gtx-t-fast) var(--gtx-ease), color var(--gtx-t-fast) var(--gtx-ease);
}

.gtx-segmented__opt:hover .gtx-segmented__box {
    color: var(--gtx-text);
    border-color: var(--gtx-line-strong);
}

.gtx-segmented__opt input:checked + .gtx-segmented__box {
    border-color: var(--gtx-accent);
    background: var(--gtx-accent-soft);
    color: var(--gtx-text);
}

.gtx-segmented__opt input:focus-visible + .gtx-segmented__box {
    outline: 2px solid var(--gtx-accent);
    outline-offset: 2px;
}

/* ----- Dark cord MODAL (used by create-server / channel / category / edit) - */
/* Re-map the shared tokens exactly like .gtx-cord so the reused .gtx-input /
   .gtx-btn / .gtx-field / .gtx-check components re-skin inside the modal, which
   is portalled onto <body> (outside the .gtx-cord subtree). */
.gtx-modal.gtx-modal--cord {
    --gtx-surface: #24262c;
    --gtx-surface-2: #2b2d34;
    --gtx-surface-hover: #2c2e35;
    --gtx-line: #34363d;
    --gtx-line-strong: #43464f;
    --gtx-text: #f2f3f5;
    --gtx-text-dim: #8a919c;
    --gtx-accent: #7c5cff;
    --gtx-accent-hover: #6b4ef0;
    --gtx-accent-fill: #7c5cff;
    --gtx-accent-fill-hover: #6b4ef0;
    --gtx-accent-soft: rgba(124, 92, 255, 0.18);
    --gtx-on-accent: #ffffff;

    --cord-column: #1c1d22;
    --cord-chat: #24262c;
    --cord-line: #34363d;
    --cord-text: #c7ccd4;
    --cord-text-dim: #8a919c;

    max-width: 30rem;
    background: #24262c;
    color: #f2f3f5;
    border-color: #34363d;
    color-scheme: dark;
}

.gtx-modal--cord .gtx-cordform__body {
    gap: var(--gtx-s4);
}

.gtx-modal--cord .gtx-cordform__form {
    gap: var(--gtx-s3);
}

.gtx-modal--cord .gtx-field__hint {
    color: var(--gtx-text-dim);
}

/* =========================================================================
 * MEMBER SIDEBAR — Discord member-list look (grouped by role → default group)
 * ========================================================================= */
.gtx-cord .gtx-grouproom__side {
    padding-top: var(--gtx-s3);
}

.gtx-cordmembers__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* The member row: avatar, name (in role colour), then quiet inline mod actions. */
.gtx-cord .gtx-cordmember {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.1rem;
}

.gtx-cord .gtx-cordmember .gtx-avatar {
    flex: 0 0 auto;
}

.gtx-cord .gtx-cordmember__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.gtx-cord .gtx-cordmember .gtx-badge {
    flex: 0 0 auto;
    font-size: 0.62rem;
    padding: 0.05rem 0.35rem;
}

/* The mod affordances (mute / kick / ban) group to the right, quiet until hover. */
.gtx-cordmember__mod {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.gtx-cord .gtx-cordmember__mod .gtx-btn {
    padding: 0.1rem 0.3rem;
    line-height: 1;
}

/* =========================================================================
 * ROLE EDITOR — Discord-look permission panels (18-flag grid, restyled only)
 * ========================================================================= */
.gtx-cord .gtx-roles__section.gtx-card {
    background: var(--cord-column);
    border: 1px solid var(--cord-line);
    border-radius: var(--gtx-r-l);
}

.gtx-cord .gtx-roles__section-legend {
    padding: 0;
    margin-bottom: var(--gtx-s2);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--cord-text-dim);
}

.gtx-check-group--section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: var(--gtx-s2) var(--gtx-s4);
    padding: var(--gtx-s3) 0;
    border-top: 1px solid var(--cord-line);
}

.gtx-check-group--section + .gtx-check-group--section {
    padding-top: var(--gtx-s3);
}

/* A permission row: checkbox + a two-line label (name + muted description). */
.gtx-check.gtx-check--perm {
    align-items: flex-start;
    gap: 0.55rem;
}

.gtx-check--perm input[type="checkbox"] {
    margin-top: 0.15rem;
    flex: 0 0 auto;
}

.gtx-check__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.gtx-check__label {
    font-weight: 600;
    color: var(--cord-text);
}

.gtx-check__desc {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--cord-text-dim);
}

/* =========================================================================
 * PINNED MESSAGES + SLOWMODE (TecXCord pins / slowmode)
 * ========================================================================= */

/* The 📌 header control + its count badge, sitting in the chat header actions area. */
.gtx-cord__head-actions {
    display: flex;
    align-items: center;
    gap: var(--gtx-s2);
    margin-left: auto;
}

.gtx-cordpins {
    position: relative;
}

.gtx-cordpins__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border: 0;
    border-radius: var(--gtx-r-m);
    background: transparent;
    color: var(--cord-text-dim);
    cursor: pointer;
    line-height: 1;
}

.gtx-cordpins__toggle:hover,
.gtx-cordpins__toggle[aria-expanded="true"] {
    background: var(--cord-hover);
    color: var(--cord-text-bright);
}

.gtx-cordpins__count {
    min-width: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--cord-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

/* The floating popover with the list of pinned messages. */
.gtx-cordpins__pop {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 40;
    width: min(22rem, 90vw);
    max-height: 24rem;
    overflow-y: auto;
    padding: var(--gtx-s3);
    background: var(--cord-column);
    border: 1px solid var(--cord-line);
    border-radius: var(--gtx-r-l);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.gtx-cordpins__head {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--cord-text-dim);
    margin-bottom: var(--gtx-s2);
}

.gtx-cordpins__empty {
    color: var(--cord-text-dim);
    font-size: 0.85rem;
    margin: var(--gtx-s2) 0;
}

.gtx-cordpins__list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gtx-cordpins__item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: var(--gtx-r-m);
}

.gtx-cordpins__item:hover {
    background: var(--cord-hover);
}

.gtx-cordpins__jump {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    border: 0;
    background: transparent;
    color: var(--cord-text);
    text-align: left;
    cursor: pointer;
}

.gtx-cordpins__author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--cord-text-bright);
}

.gtx-cordpins__snippet {
    font-size: 0.8rem;
    color: var(--cord-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gtx-cordpins__unpin {
    flex: 0 0 auto;
    margin-right: 0.25rem;
    width: 1.4rem;
    height: 1.4rem;
    border: 0;
    border-radius: var(--gtx-r-m);
    background: transparent;
    color: var(--cord-text-dim);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.gtx-cordpins__unpin:hover {
    background: var(--cord-hover);
    color: var(--cord-text-bright);
}

/* The subtle "angeheftet" marker above a pinned message + a faint row tint. */
.gtx-cordmsg__pin-marker {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cord-text-dim);
}

.gtx-cordmsg__pin-icon {
    font-size: 0.7rem;
    line-height: 1;
}

.gtx-msg--pinned {
    background: var(--cord-accent-soft);
}

/* The composer slowmode hint; turns amber-ish while a wait is counting down. */
.gtx-composer__slowmode {
    padding: 0.15rem var(--gtx-s3) 0;
    font-size: 0.72rem;
    color: var(--cord-text-dim);
}

.gtx-composer__slowmode.is-waiting {
    color: var(--cord-text-bright);
    font-weight: 600;
}
