/**
 * Suffah - Phase 97: desktop / laptop layout (X style).
 *   >= 1280px : left menu (icons + labels) | feed 600px | right sidebar 350px
 *   1000-1279 : left icon rail            | feed 600px | right sidebar 290px
 *   700-999   : left icon rail            | feed 600px
 *   < 700px   : unchanged mobile layout
 * Loaded last. The page itself (body) becomes the centre column, so every page
 * (feed, profile, post, settings, messages ...) fits without changes.
 */
.dkl, .dkr, .dkcomp { display: none; }

@media (min-width: 700px) {
    :root { --dk-left: 80px; --dk-center: 600px; --dk-right: 0px; }
}
@media (min-width: 1000px) {
    :root { --dk-right: 290px; }
}
@media (min-width: 1280px) {
    :root { --dk-left: 275px; --dk-right: 350px; }
}

@media (min-width: 700px) {
    :root {
        --dk-x0: calc(50% - (var(--dk-left) + var(--dk-center) + var(--dk-right)) / 2);
        --dk-x1: calc(var(--dk-x0) + var(--dk-left));
    }
    html { font-size: 100%; background: var(--bg-primary); }
    body { width: var(--dk-center); margin: 0 0 0 var(--dk-x0); padding-left: 0; background: var(--bg-primary); min-height: 100vh; box-sizing: content-box; }
    body { margin-left: var(--dk-x1); }
    .app-shell { width: 100%; }
    .main-content { padding-bottom: var(--space-6); border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); box-sizing: border-box; min-height: 100vh; }
    .basic-shell { border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); box-sizing: border-box; min-height: 100vh; }
    body > .basic-shell { max-width: none; margin: 0; }

    /* phone-only controls */
    .mobile-nav, .compose-fab { display: none !important; }
    .mobile-topbar:not(.mobile-topbar--x) { display: none; }
    .mobile-topbar ~ .tabs { top: 0; }
    .tabs { background: var(--bg-primary); }
    .new-posts-pill { top: 64px; left: calc(var(--dk-x1) + var(--dk-center) / 2); }
    .post-card__actions { max-width: none; }

    /* fixed bars stay inside the centre column */
    .xpost__replybar, .rb, .xlang__foot, .xrep__foot, .xprof__sticky, .xprof__tabs.is-pinned {
        left: var(--dk-x1); right: auto; width: var(--dk-center); margin: 0; box-sizing: border-box;
    }
    .xset__fab { right: auto; left: calc(var(--dk-x1) + var(--dk-center) - 78px); }
    .toast-container { left: var(--dk-x1); right: auto; width: var(--dk-center); box-sizing: border-box; padding: 0 16px; }

    /* ---- left menu ---- */
    .dkl { display: flex; flex-direction: column; position: fixed; z-index: 40; top: 0; bottom: 0; left: var(--dk-x0); width: var(--dk-left); box-sizing: border-box; padding: 4px 4px 12px; align-items: center; overflow: visible; }
    .dkl__logo { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; color: var(--color-accent); margin: 2px 0; }
    .dkl__logo:hover { background: var(--bg-hover); }
    .dkl__logo img { height: 30px; width: auto; }
    .dkl__list { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
    .dkl__item { position: relative; display: inline-flex; align-items: center; gap: 20px; height: 52px; padding: 0 13px; border-radius: 999px; color: var(--text-primary); text-decoration: none; cursor: pointer; list-style: none; font-size: 1.25rem; line-height: 1.2; background: none; border: 0; font-family: inherit; }
    .dkl__item::-webkit-details-marker { display: none; }
    .dkl__item:hover, .dkl__more[open] > summary { background: var(--bg-hover); }
    .dkl__item.is-on .dkl__tx { font-weight: 800; }
    .dkl__ic { position: relative; display: inline-flex; width: 26px; height: 26px; flex: none; }
    .dkl__tx { display: none; white-space: nowrap; }
    .dkl__badge { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-accent); color: var(--text-on-accent, #fff); font-size: .7rem; font-weight: 800; line-height: 18px; text-align: center; box-sizing: border-box; border: 2px solid var(--bg-primary); }
    .dkl__badge[hidden] { display: none; }
    .dkl__more { position: relative; }
    .dkl__post { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-top: 14px; border-radius: 50%; background: var(--color-accent); color: var(--text-on-accent, #fff); text-decoration: none; font-weight: 800; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
    .dkl__post:hover { filter: brightness(1.08); }
    .dkl__post-tx { display: none; }
    .dkl__post-ic svg { stroke: currentColor; }
    .dkl__me { position: relative; margin-top: auto; width: 100%; display: flex; justify-content: center; }
    .dkl__me > summary { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 999px; cursor: pointer; list-style: none; width: 100%; box-sizing: border-box; justify-content: center; }
    .dkl__me > summary::-webkit-details-marker { display: none; }
    .dkl__me > summary:hover, .dkl__me[open] > summary { background: var(--bg-hover); }
    .dkl__me .avatar { width: 40px; height: 40px; flex: none; overflow: hidden; }
    .dkl__me .avatar img { width: 100%; height: 100%; object-fit: cover; }
    .dkl__who, .dkl__dots { display: none; }
    .dkl__guest { margin-top: auto; display: none; }

    .dkm { position: absolute; z-index: 60; min-width: 270px; padding: 8px 0; border-radius: 16px; background: var(--bg-primary); box-shadow: 0 0 15px rgba(101, 119, 134, .25), 0 0 3px 1px rgba(101, 119, 134, .15); }
    [data-theme="dark"] .dkm { box-shadow: 0 0 12px rgba(255, 255, 255, .22); }
    .dkm--more { left: 0; bottom: calc(100% - 52px); }
    .dkm--me { left: 6px; bottom: calc(100% + 6px); }
    .dkm form { margin: 0; }
    .dkm__row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; background: none; color: var(--text-primary); font: inherit; font-size: 1rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; box-sizing: border-box; }
    .dkm__row:hover { background: var(--bg-hover); }
    .dkm__row .avatar { width: 28px; height: 28px; font-size: .8rem; overflow: hidden; }
    .dkm__row .avatar img { width: 100%; height: 100%; object-fit: cover; }
    .dkm__row .drawer__moon { display: none; }
    [data-theme="dark"] .dkm__row .drawer__sun { display: none; }
    [data-theme="dark"] .dkm__row .drawer__moon { display: inline-block; }

    /* ---- home: composer card (taps open the full composer) ---- */
    .dkcomp { display: block; padding: 12px 16px 0; border-bottom: 1px solid var(--border-color); color: inherit; text-decoration: none; background: var(--bg-primary); }
    .dkcomp__row { display: flex; gap: 12px; align-items: center; }
    .dkcomp .avatar { width: 40px; height: 40px; flex: none; overflow: hidden; }
    .dkcomp .avatar img { width: 100%; height: 100%; object-fit: cover; }
    .dkcomp__ph { flex: 1; font-size: 1.25rem; color: var(--text-tertiary); padding: 12px 0; }
    .dkcomp__bar { display: flex; align-items: center; gap: 4px; padding: 6px 0 10px 52px; color: var(--color-accent); }
    .dkcomp__bar svg { padding: 7px; box-sizing: content-box; }
    .dkcomp__post { margin-left: auto; padding: 8px 18px; border-radius: 999px; background: var(--color-accent); color: var(--text-on-accent, #fff); font-weight: 800; opacity: .55; }
}

@media (min-width: 1000px) {
    .dkr { display: block; position: fixed; z-index: 30; top: 0; bottom: 0; left: calc(var(--dk-x1) + var(--dk-center)); width: var(--dk-right); box-sizing: border-box; padding: 0 0 24px 24px; overflow-y: auto; scrollbar-width: none; }
    .dkr::-webkit-scrollbar { display: none; }
    .dkr__search { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; height: 53px; padding: 4px 0; background: var(--bg-primary); color: var(--text-tertiary); }
    .dkr__search svg { position: absolute; left: 18px; pointer-events: none; }
    .dkr__search input { width: 100%; height: 44px; padding: 0 18px 0 48px; border: 1px solid transparent; border-radius: 999px; background: var(--bg-secondary); color: var(--text-primary); font: inherit; font-size: .95rem; outline: none; box-sizing: border-box; }
    .dkr__search input:focus { background: var(--bg-primary); border-color: var(--color-accent); }
    .dkr__card { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-primary); }
    .dkr__card--flush { padding: 12px 0 0; background: var(--bg-secondary); border-color: transparent; overflow: hidden; }
    .dkr__card h2 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 800; color: var(--text-primary); }
    .dkr__card--flush h2 { padding: 0 16px; }
    .dkr__card p { margin: 0 0 12px; font-size: .95rem; line-height: 1.35; color: var(--text-primary); }
    .dkr__btn { display: flex; align-items: center; justify-content: center; height: 40px; margin-top: 8px; border-radius: 999px; border: 1px solid var(--border-color); color: var(--color-accent); font-weight: 800; text-decoration: none; }
    .dkr__btn--main { background: var(--text-primary); color: var(--bg-primary); border-color: transparent; }
    .dkr__btn--auto { display: inline-flex; padding: 0 20px; background: var(--color-accent); color: var(--text-on-accent, #fff); }
    .dkr__trend { display: block; padding: 10px 16px; color: inherit; text-decoration: none; }
    .dkr__trend:hover, .dkr__person:hover { background: rgba(127, 127, 127, .1); }
    .dkr__trend small { display: block; color: var(--text-tertiary); font-size: .8rem; line-height: 1.3; }
    .dkr__trend strong { display: block; font-size: 1rem; font-weight: 800; line-height: 1.35; color: var(--text-primary); }
    .dkr__more { display: block; padding: 14px 16px; color: var(--color-accent); text-decoration: none; font-size: .95rem; }
    .dkr__more:hover { background: rgba(127, 127, 127, .1); }
    .dkr__empty { padding: 0 16px 14px; color: var(--text-tertiary) !important; }
    .dkr__person { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
    .dkr__pl { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
    .dkr__pl .avatar { width: 40px; height: 40px; flex: none; overflow: hidden; }
    .dkr__pl .avatar img { width: 100%; height: 100%; object-fit: cover; }
    .dkr__pn { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
    .dkr__pn strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
    .dkr__pn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-tertiary); font-size: .85rem; }
    .dkr__follow { padding: 7px 16px; flex: none; }
    .dkr__foot { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 16px 16px 0; font-size: .8rem; color: var(--text-tertiary); }
    .dkr__foot a { color: var(--text-tertiary); text-decoration: none; }
    .dkr__foot a:hover { text-decoration: underline; }
}

/* full left menu on wide laptops / desktops */
@media (min-width: 1280px) {
    .dkl { align-items: flex-start; padding: 4px 12px 12px; }
    .dkl__list { align-items: flex-start; }
    .dkl__logo { margin-left: 4px; }
    .dkl__tx { display: inline; }
    .dkl__item { padding: 0 20px 0 13px; }
    .dkl__post { width: calc(100% - 16px); margin: 16px 8px 0; border-radius: 999px; font-size: 1.1rem; }
    .dkl__post-tx { display: inline; }
    .dkl__post-ic { display: none; }
    .dkl__me > summary { justify-content: flex-start; }
    .dkl__who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
    .dkl__who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; color: var(--text-primary); }
    .dkl__who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-tertiary); font-size: .9rem; }
    .dkl__dots { display: inline-flex; color: var(--text-primary); }
    .dkl__guest { display: flex; flex-direction: column; gap: 10px; width: calc(100% - 16px); margin: auto 8px 8px; }
    .dkl__btn { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 999px; border: 1px solid var(--border-color); color: var(--color-accent); font-weight: 800; text-decoration: none; }
    .dkl__btn--main { background: var(--color-accent); color: var(--text-on-accent, #fff); border-color: transparent; }
    .dkm--more { left: 0; }
    .dkm--me { left: 0; width: calc(100% - 8px); min-width: 250px; }
}
@media (min-width: 700px) and (max-width: 1279px) {
    .dkl__guest { display: flex; flex-direction: column; gap: 10px; width: 56px; margin: auto 0 8px; }
    .dkl__btn { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 999px; background: var(--color-accent); color: var(--text-on-accent, #fff); font-size: .7rem; font-weight: 800; text-decoration: none; text-align: center; line-height: 1.1; }
    .dkl__btn:not(.dkl__btn--main) { display: none; }
}

.dkr__follow { border: 0; border-radius: 999px; background: var(--text-primary); color: var(--bg-primary); font: inherit; font-weight: 800; font-size: .9rem; cursor: pointer; }
.dkr__follow.is-following { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }

/* short laptop screens: compact the menu so nothing is squashed */
@media (min-width: 700px) {
    .dkl__post, .dkl__me, .dkl__list, .dkl__logo { flex: none; }
    .mobile-topbar--x .mobile-topbar__avatar { visibility: hidden; pointer-events: none; }
}
@media (min-width: 700px) and (max-height: 820px) {
    .dkl__item { height: 46px; }
    .dkl__logo { width: 46px; height: 46px; }
    .dkl__post { height: 46px; margin-top: 8px; }
    .dkl__me > summary { padding: 6px 10px; }
}
@media (min-width: 700px) and (max-height: 680px) {
    .dkl__item { height: 40px; }
    .dkl__logo { width: 40px; height: 40px; }
    .dkl__post { height: 40px; width: 40px; }
    .dkl__post-tx { font-size: 1rem; }
}
@media (min-width: 1280px) and (max-height: 680px) {
    .dkl__post { width: calc(100% - 16px); }
}

/* ---- Phase 98: inline composer, promo card, welcome state (desktop) ---- */
.dkc, .dkpromo, .dkwelcome { display: none; }
@media (min-width: 700px) {
    .dkc { display: block; padding: 4px 16px 0; border-bottom: 1px solid var(--border-color); background: var(--bg-primary); }
    .dkc__row { display: flex; gap: 12px; padding-top: 8px; }
    .dkc__av { width: 40px; height: 40px; flex: none; overflow: hidden; margin-top: 4px; }
    .dkc__av img { width: 100%; height: 100%; object-fit: cover; }
    .dkc__main { flex: 1; min-width: 0; }
    .dkc__ta, .dkc .rte-editor { display: block; width: 100%; box-sizing: border-box; border: 0; outline: none; resize: none; background: transparent; color: var(--text-primary); font: inherit; font-size: 1.25rem; line-height: 1.35; padding: 12px 0; min-height: 28px; max-height: 360px; overflow-y: auto; }
    .dkc .rte-editor { --rte-rows: 1; }
    .dkc__prev { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 4px 0 10px; }
    .dkc__prev[hidden] { display: none; }
    .dkc__thumb { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--bg-secondary); }
    .dkc__thumb img, .dkc__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
    .dkc__rm { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(15, 20, 25, .75); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
    .dkc__who { display: none; align-items: center; gap: 6px; padding: 6px 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border-color); color: var(--color-accent); font-weight: 700; font-size: .9rem; position: relative; width: fit-content; max-width: 100%; }
    .dkc.is-active .dkc__who { display: flex; }
    .dkc__who select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; outline: none; padding: 0 4px 0 0; max-width: 300px; }
    .dkc__bar { display: flex; align-items: center; gap: 0; padding: 6px 0 10px; margin-left: -8px; }
    .dkc__tool { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--color-accent); cursor: pointer; text-decoration: none; }
    .dkc__tool:hover { background: rgba(29, 155, 240, .1); }
    .dkc__emowrap { position: relative; display: inline-flex; }
    .dkc__sp { flex: 1; }
    .dkc__rsvg { margin-right: 10px; }
    .dkc__rbg { fill: none; stroke: var(--border-color); stroke-width: 2.5; }
    .dkc__ring { fill: none; stroke: var(--color-accent); stroke-width: 2.5; stroke-linecap: round; }
    .dkc__ring.is-warn { stroke: #ffd400; }
    .dkc__ring.is-over { stroke: #f4212e; }
    .dkc__rsvg { opacity: 0; }
    .dkc.is-active .dkc__rsvg { opacity: 1; }
    .dkc__send { margin-right: 0; padding: 0 18px; height: 36px; border: 0; border-radius: 999px; background: var(--color-accent); color: var(--text-on-accent, #fff); font: inherit; font-weight: 800; cursor: pointer; }
    .dkc__send:disabled { opacity: .5; cursor: default; }
    .dkc__emo { position: absolute; z-index: 70; top: 40px; left: -8px; width: 300px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; border-radius: 14px; background: var(--bg-primary); box-shadow: 0 0 15px rgba(101, 119, 134, .3), 0 0 3px 1px rgba(101, 119, 134, .15); }
    .dkc__emo button { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: 6px 0; border-radius: 8px; cursor: pointer; }
    .dkc__emo button:hover { background: var(--bg-hover); }

    .dkpromo { display: block; position: relative; margin: 0; padding: 14px 16px 16px; border-bottom: 1px solid var(--border-color); }
    .dkpromo h2 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 800; color: var(--text-primary); }
    .dkpromo p { margin: 0 0 12px; color: var(--text-secondary); font-size: .95rem; line-height: 1.35; }
    .dkpromo__btn { display: inline-flex; align-items: center; height: 36px; padding: 0 20px; border-radius: 999px; background: var(--text-primary); color: var(--bg-primary); font-weight: 800; text-decoration: none; }

    .dkwelcome { display: block; padding: 32px 32px 40px 32px; }
    .dkwelcome h2 { margin: 0 0 8px; font-size: 2.1rem; font-weight: 800; color: var(--text-primary); line-height: 1.15; }
    .dkwelcome p { margin: 0 0 24px; max-width: 360px; color: var(--text-secondary); font-size: 1rem; line-height: 1.35; }
    .dkwelcome__btn { display: inline-flex; align-items: center; justify-content: center; min-width: 130px; height: 52px; padding: 0 28px; border-radius: 999px; background: var(--color-accent); color: var(--text-on-accent, #fff); font-weight: 800; font-size: 1.05rem; text-decoration: none; }
    .dkcomp { display: none; }
}
@media (min-width: 700px) { .dkc__prev.is-one { grid-template-columns: 1fr; } .dkc__prev.is-one .dkc__thumb { aspect-ratio: 16 / 9; } }

/* Phase 98: placeholder of the formatted editor (it never showed because the pseudo-element read the attribute from the inner line) */
.rte-editor { position: relative; }
.rte-editor.is-empty::before { content: attr(data-placeholder); position: absolute; left: 0; top: 0; padding: inherit; color: var(--text-tertiary, #8b98a5); pointer-events: none; white-space: nowrap; overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.rte-editor.is-empty > div:first-child::before { content: none; }
.dkghead { display: none; } @media (min-width: 700px) { .dkghead { display: flex; } }
