/* =====================================================================
   Layout editor (beta). Only applies while html.custom-layout-on is set,
   which layout-editor.js does on wide screens for members who chose
   "Your layout". Builds on the Original Vexel styles.
   ===================================================================== */
.custom-layout-on .app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body.has-pcbar .custom-layout-on .app, .custom-layout-on body.has-pcbar .app { height: calc(100dvh - var(--pcbar-h, 0px)); }
.custom-layout-on .app > .deck, .custom-layout-on .app > .shell { display: none !important; }
.cl-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap, 8px); padding: var(--gap, 8px); }
.cl-bars { display: flex; flex-direction: column; gap: var(--gap, 8px); flex: none; }
.cl-bars:empty { display: none; }
.cl-bar { display: flex; gap: var(--gap, 8px); height: 56px; min-width: 0; }
.cl-mid { flex: 1; min-height: 0; display: flex; gap: var(--gap, 8px); }
.cl-col { display: flex; flex-direction: column; gap: var(--gap, 8px); flex: none; min-height: 0; }
.cl-under { display: flex; flex-direction: column; gap: var(--gap, 8px); flex: none; }
.cl-center { flex: 1; min-width: 0; min-height: 0; display: flex; }
.cl-center > .main { flex: 1; min-width: 0; min-height: 0; }
.cl-part { position: relative; display: flex; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel-r, 12px); background: var(--bg-2); }
.cl-part[data-tone="light"] { background: var(--bg-3); }
.cl-under > .cl-part, .cl-edge > .cl-part { flex: none !important; }
.cl-edge > .cl-part[data-part="profile"] { margin-top: auto; }
.cl-part[data-part="members"]:empty { display: none; }
.cl-col:not(:has(.cl-part:not(:empty))), .cl-bar:not(:has(.cl-part:not(:empty))) { display: none; }
.cl-bar > .cl-part { height: 100%; }

/* ----- server bar ----- */
.cl-part[data-part="servers"] .deck-servers { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 8px; -webkit-mask-image: none; mask-image: none; scrollbar-width: none; }
.cl-part[data-part="servers"] .deck-servers::-webkit-scrollbar { display: none; }
.cl-h[data-part="servers"] .deck-servers { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
.cl-v[data-part="servers"] .deck-servers { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.cl-part[data-part="servers"] .dtile { flex: none; }
.cl-part[data-part="servers"] .dtile-btn { width: 40px; height: 40px; }
.cl-v[data-part="servers"] .dtile-btn { width: 46px; height: 46px; }
.cl-v[data-part="servers"] .dtile-sep { width: 32px; height: 2px; }
.cl-h[data-part="servers"] .dtile-sep { width: 2px; height: 28px; }
.cl-part[data-part="servers"][data-align="center"] .deck-servers { justify-content: safe center; }
.cl-part[data-part="servers"][data-align="end"] .deck-servers { justify-content: safe flex-end; }
.cl-part.hide-home .dtile.home, .cl-part.hide-add .dtile:has([data-act="addServer"]), .cl-part.hide-discover .dtile:has([data-act="discover"]) { display: none; }

/* ----- side list ----- */
.cl-part[data-part="side"] > .nav { flex: 1; width: auto !important; min-width: 0; min-height: 0; display: flex; }
.cl-part[data-part="side"] .sidebar { flex: 1; min-width: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; }
.cl-part[data-part="side"] .drawer-servers { display: none !important; }
.cl-part.hide-hub .hub-grid, .cl-part.hide-hub .dm-requests-link { display: none; }
.cl-part.hide-header :is(.panel-head, .server-card) { display: none; }
/* on a bar the list becomes a slim strip that scrolls sideways */
.cl-h[data-part="side"] .side-inner { display: flex; flex-direction: row; align-items: center; height: 100%; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 0 8px; scrollbar-width: thin; }
.cl-h[data-part="side"] :is(.side-scroll, .hub-grid, .cat-group, .chan-list) { display: flex !important; flex-direction: row; align-items: center; gap: 6px; flex: none; overflow: visible; height: auto; padding: 0; margin: 0; }
.cl-h[data-part="side"] .side-inner > *, .cl-h[data-part="side"] .side-scroll > * { flex: none; }
.cl-h[data-part="side"] :is(.panel-head, .server-card) { border: 0; padding: 0 8px 0 0; height: auto; min-height: 0; background: transparent; box-shadow: none; }
.cl-h[data-part="side"] :is(.chan, .dm-item, .hub-tile) { margin: 0; white-space: nowrap; height: 34px; min-height: 0; border-radius: 8px; }
.cl-h[data-part="side"] .hub-tile { padding: 0 10px; }
.cl-h[data-part="side"] .cat { padding: 0 4px; white-space: nowrap; }
.cl-h[data-part="side"] :is(.sc-cover, .community-navigation, .boost-bar, .cat-empty, .cat > button, .hub-beta) { display: none !important; }
.cl-h[data-part="side"] :is(.chan, .dm-item, .hub-tile, .cat, .server-card, .sc-row) { width: auto !important; flex: none; }
.cl-h[data-part="side"] .chan { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; }
.cl-h[data-part="side"] .chan :is(.chan-actions, .chan-tools) { display: none; }
.cl-h[data-part="side"] .cat { font-size: 11px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; margin-left: 4px; }
.cl-h[data-part="side"] .cat svg { display: none; }
.cl-h[data-part="side"] .sc-row { min-height: 0; padding: 0 6px; }

/* ----- member list ----- */
.cl-part[data-part="members"] .members { flex: 1; width: auto !important; min-width: 0; border: 0 !important; background: transparent !important; overflow-y: auto; }
.cl-h[data-part="members"] .members { display: flex; flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 0 8px; }
.cl-h[data-part="members"] .members h4 { display: none; }
.cl-h[data-part="members"] .member { flex: none; }
.cl-h[data-part="members"] .member .mn span { display: none; }
.cl-part.hide-offline .member.offline, .cl-part.hide-offline h4:has(+ .member.offline) { display: none; }
.custom-layout-on #main #members { display: none; } /* left in the chat only while the member list is hidden */
.custom-layout-on #main .members-back { display: none; }

/* ----- profile and voice ----- */
.cl-profile { flex: 1; min-width: 0; display: flex; }
.cl-v .cl-profile { flex-direction: column; justify-content: flex-end; }
.cl-h .cl-profile { flex-direction: row; align-items: center; gap: 8px; padding: 0 8px; }
.cl-v[data-align="start"] .cl-profile { justify-content: flex-start; }
.cl-v[data-align="center"] .cl-profile, .cl-h[data-align="center"] .cl-profile { justify-content: center; }
.cl-h[data-align="end"] .cl-profile { justify-content: flex-end; }
.cl-profile #userpanel { display: flex; align-items: center; min-height: 52px; padding: 0 8px; background: transparent; }
.cl-h .cl-profile #userpanel { min-height: 0; padding: 0; }
.cl-profile #voicepanel:empty { display: none; }
.cl-v .cl-profile #voicepanel { border-bottom: 1px solid var(--line); }
.cl-v .cl-profile .me-cluster { display: flex; width: 100%; align-items: center; }
.cl-v .cl-profile .me-chip { flex: 1; min-width: 0; max-width: none; }
.cl-v .cl-profile .me-chip .who { display: block !important; }
.cl-part.hide-voice #voicepanel, .cl-part.hide-profile #userpanel { display: none; }

/* ----- shortcuts ----- */
#cl-shortcuts { flex: 1; display: flex; gap: 4px; padding: 6px; min-width: 0; min-height: 0; }
.cl-v #cl-shortcuts { flex-direction: column; align-items: center; overflow-y: auto; }
.cl-h #cl-shortcuts { flex-direction: row; align-items: center; overflow-x: auto; }
.cl-part[data-part="shortcuts"][data-align="center"] #cl-shortcuts { justify-content: safe center; }
.cl-part[data-part="shortcuts"][data-align="end"] #cl-shortcuts { justify-content: safe flex-end; }
.cl-short { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); }
.cl-short:hover { background: var(--bg-hover); color: var(--text); }
.cl-short .badge { position: absolute; top: 2px; right: 2px; }
.cl-short-label { font-size: 13px; font-weight: 600; }
.cl-v .cl-short-label { display: none; }
.cl-v .cl-short { padding: 0; width: 40px; }

/* ----- unread ----- */
#cl-unread { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px; min-width: 0; min-height: 0; overflow-y: auto; }
.cl-h #cl-unread { flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; padding: 0 8px; }
.cl-unread-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 2px 6px 6px; flex: none; }
.cl-h .cl-unread-title { padding: 0 6px; }
.cl-unread-item { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; flex: none; }
.cl-unread-item:hover { background: var(--bg-hover); }
.cl-unread-item > span:not(.badge):not(.cl-unread-srv) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
.cl-unread-item small { color: var(--muted); font-weight: 500; }
.cl-unread-srv { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--bg-3); }
.cl-unread-empty { color: var(--muted); font-size: 13px; padding: 6px; margin: 0; white-space: nowrap; }

/* ===================== the editor ===================== */
.layout-editor .le-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.le-preset { border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; font-size: 14px; background: color-mix(in srgb, var(--green, #3ba55d) 22%, var(--bg-2)); color: color-mix(in srgb, var(--green, #3ba55d) 70%, var(--text)); }
.le-preset:hover { background: color-mix(in srgb, var(--green, #3ba55d) 32%, var(--bg-2)); }
.le-board { max-width: 520px; user-select: none; -webkit-user-select: none; touch-action: none; }
.le-frame { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); }
.le-zone { position: relative; border: 1px dashed color-mix(in srgb, var(--text-2) 35%, transparent); border-radius: 3px; min-height: 40px; }
.le-zone.le-target { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.le-bars { display: flex; flex-direction: column; padding: 2px 4px; }
.le-cols { display: flex; flex-direction: row; padding: 4px 2px; min-width: 56px; }
.le-mid { display: flex; gap: 8px; min-height: 160px; }
.le-chat { flex: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 3px; color: var(--text-2); font-size: 13px; min-height: 140px; }
.le-slot { display: flex; gap: 0; }
.le-slot.le-h { flex-direction: row; min-height: 28px; }
.le-slot.le-v { flex-direction: column; width: 56px; min-height: 140px; }
.le-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); font-size: 13px; pointer-events: none; }
.le-part { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); border-radius: 2px; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 500; cursor: grab; text-align: center; overflow: hidden; }
.le-slot.le-v .le-part { writing-mode: vertical-rl; }
.le-part:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.le-part.le-moving { opacity: .4; }
.le-part.le-join-before { box-shadow: inset 3px 0 0 var(--gold); }
.le-part.le-join-after { box-shadow: inset -3px 0 0 var(--gold); }
.le-slot.le-v .le-part.le-join-before { box-shadow: inset 0 3px 0 var(--gold); }
.le-slot.le-v .le-part.le-join-after { box-shadow: inset 0 -3px 0 var(--gold); }
.le-ghost { position: fixed; z-index: 9999; pointer-events: none; padding: 6px 10px; border-color: var(--gold); box-shadow: 0 6px 20px rgba(0, 0, 0, .4); writing-mode: horizontal-tb !important; }
.le-gap { flex: none; transition: background .1s; }
.le-bars > .le-gap { height: 4px; }
.le-cols > .le-gap { width: 4px; }
.le-dragging .le-bars > .le-gap { height: 12px; }
.le-dragging .le-cols > .le-gap { width: 12px; }
.le-gap.le-target { background: var(--gold); border-radius: 2px; }
.le-div { flex: none; background: color-mix(in srgb, var(--text) 18%, transparent); }
.le-slot.le-h > .le-div { width: 6px; cursor: col-resize; }
.le-slot.le-v > .le-div { height: 6px; cursor: row-resize; }
.le-div:hover { background: var(--gold); }
.le-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.le-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; min-height: 40px; }
.le-zlabel { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-right: 4px; }
.le-list .le-part { flex: none !important; }
.le-actions { display: flex; gap: 8px; margin: 12px 0 6px; }
.le-options fieldset { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.le-options legend { font-weight: 600; margin-bottom: 6px; }
.layout-sketch.custom i:nth-child(1) { background: var(--gold); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) { .le-extra { grid-template-columns: 1fr; } }
/* labels only where there's room for them */
.cl-part[data-part="shortcuts"] { container-type: inline-size; }
@container (max-width: 760px) { .cl-h .cl-short-label { display: none; } .cl-h .cl-short { width: 40px; padding: 0; } }
