/* Dexapp Studio signed-in frame. It follows the sign-in card: the sidebar is the card's brand
   panel, the content area its form panel (plain surface). The sidebar carries the theme colour
   evenly across its surface, with accent-tinted edges for a calm, corporate frame. Colours come only from dex-theme.css tokens.
   Breakpoints: phone <= 760px (drawer + bottom menu, single screen), tablet <= 1180px
   (narrow sidebar), desktop above (wide or narrow sidebar, the user's choice). */

:root {
    --dx-sidebar-w: 248px;
    --dx-sidebar-narrow-w: 76px;
    --dx-topbar-h: 48px;
    --dx-bottom-nav-h: 64px;
    /* Profile card at the foot of the sidebar. Dashboard quick access cards share these, so on a
       dashboard that fits the screen both rows line up (same height, same bottom edge). */
    --dx-foot-h: 58px;
    --dx-foot-gap: 14px;

    /* Sidebar: the theme colour spread evenly, edges in an accent-tinted line. */
    --dx-side-bg: color-mix(in srgb, var(--dx-accent) 8%, var(--dx-surface-2));
    --dx-side-line: color-mix(in srgb, var(--dx-accent) 26%, var(--dx-line));
    --dx-side-text: var(--dx-text);
    --dx-side-hover: color-mix(in srgb, var(--dx-accent) 7%, transparent);
    --dx-side-active: color-mix(in srgb, var(--dx-accent) 14%, var(--dx-surface));
    /* Product name: "Dexapp" in a deep tone of the accent, "Studio" in a light one. */
    --dx-name-strong: color-mix(in srgb, var(--dx-accent) 72%, #000);
    --dx-name-soft: color-mix(in srgb, var(--dx-accent) 72%, #fff);
}

:root[data-theme="dark"] {
    --dx-side-bg: color-mix(in srgb, var(--dx-accent) 7%, var(--dx-surface));
    --dx-side-line: color-mix(in srgb, var(--dx-accent) 30%, var(--dx-line));
    --dx-side-hover: color-mix(in srgb, var(--dx-accent) 9%, transparent);
    --dx-side-active: color-mix(in srgb, var(--dx-accent) 20%, var(--dx-surface));
    --dx-name-strong: var(--dx-accent);
    --dx-name-soft: color-mix(in srgb, var(--dx-accent) 45%, #fff);
}

/* ---- Frame ---- */

.dx-shell {
    --dx-side: var(--dx-sidebar-w);
    display: grid;
    grid-template-columns: var(--dx-side) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    background: var(--dx-surface);
    color: var(--dx-text);
    font-family: var(--dx-font);
    transition: grid-template-columns .28s var(--dx-ease);
}

:root[data-sidebar="collapsed"] .dx-shell { --dx-side: var(--dx-sidebar-narrow-w); }

@media (display-mode: window-controls-overlay) {
    .dx-shell { height: calc(100dvh - env(titlebar-area-height, 0px)); }
}

.dx-shell__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--dx-surface);
}

.dx-workspace {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 28px 32px 40px;
    background: var(--dx-surface);
    scrollbar-gutter: stable;
}

.dx-shell__scrim { display: none; }

.dx-ico {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- Sidebar ---- */

.dx-sidebar {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: var(--dx-side-bg);
    color: var(--dx-side-text);
    border-right: 1px solid var(--dx-side-line);
}

.dx-sidebar__brand {
    display: flex;
    align-items: center;
    height: var(--dx-topbar-h);
    flex: none;
    padding: 0 12px 0 18px;
    border-bottom: 1px solid var(--dx-side-line);
}

.dx-sidebar__home {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 4px;
    margin-left: -4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.dx-sidebar__home:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

.dx-sidebar__logo {
    width: 28px;
    flex: none;
}

.dx-sidebar__name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.015em;
    white-space: nowrap;
}

.dx-sidebar__name-strong { color: var(--dx-name-strong); }
.dx-sidebar__name-soft { color: var(--dx-name-soft); font-weight: 600; }

.dx-sidebar__close {
    display: none;
    margin-left: auto;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--dx-line);
    border-radius: 10px;
    background: var(--dx-surface);
    color: var(--dx-muted);
    cursor: pointer;
}

.dx-sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--dx-text) 18%, transparent) transparent;
}

.dx-nav {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dx-nav__title {
    margin: 14px 10px 8px;
    color: var(--dx-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.dx-nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: color-mix(in srgb, var(--dx-text) 78%, transparent);
    font-size: var(--dx-text-md);
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s, color .18s, box-shadow .18s;
}

.dx-nav__link .dx-ico { color: var(--dx-muted); transition: color .18s; }
.dx-nav__link:hover { background: var(--dx-side-hover); color: var(--dx-text); }

.dx-nav__link.is-active {
    border-color: var(--dx-side-line);
    background: var(--dx-side-active);
    color: var(--dx-text);
    font-weight: 650;
}

/* Indicator on the sidebar edge, as in the reference */
.dx-nav__link.is-active::before {
    content: "";
    position: absolute;
    left: -13px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--dx-accent);
}

.dx-nav__link.is-active .dx-ico { color: var(--dx-accent-text); }
.dx-nav__link:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

.dx-nav__empty {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 12px;
    border: 1px dashed var(--dx-side-line);
    border-radius: 10px;
    color: var(--dx-muted);
    font-size: var(--dx-text-xs);
    line-height: 1.45;
}

.dx-nav__empty .dx-ico { width: 18px; height: 18px; margin-top: 1px; color: var(--dx-accent-text); }

.dx-sidebar__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    height: var(--dx-foot-h);
    margin: 0 12px var(--dx-foot-gap);
    padding: 0 8px 0 10px;
    border: 1px solid var(--dx-side-line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--dx-surface) 70%, transparent);
}

.dx-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    margin: -4px;
    padding: 4px;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    transition: background .15s;
}

.dx-profile:hover { background: color-mix(in srgb, var(--dx-accent) 9%, transparent); }
.dx-profile:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

.dx-profile__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.dx-profile__text strong,
.dx-profile__text small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dx-profile__text strong { font-size: var(--dx-text-sm); font-weight: 650; }
.dx-profile__text small { color: var(--dx-muted); font-size: var(--dx-text-xs); }
.dx-profile__logout { margin: 0; }

.dx-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 11px;
    background: var(--dx-accent-gradient);
    color: var(--dx-on-accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

.dx-side-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--dx-muted);
    cursor: pointer;
    transition: background .18s, color .18s;
}

.dx-side-button .dx-ico { width: 19px; height: 19px; }
.dx-side-button:hover { background: color-mix(in srgb, var(--dx-danger) 12%, transparent); color: var(--dx-danger); }
.dx-side-button:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

/* Narrow sidebar: logo, module icons, avatar and sign-out only */
@media (min-width: 761px) {
    :root[data-sidebar="collapsed"] .dx-sidebar__name,
    :root[data-sidebar="collapsed"] .dx-sidebar__label,
    :root[data-sidebar="collapsed"] .dx-profile__text,
    :root[data-sidebar="collapsed"] .dx-nav__empty span { display: none; }

    :root[data-sidebar="collapsed"] .dx-nav__title {
        height: 1px;
        margin: 12px 14px;
        overflow: hidden;
        background: var(--dx-side-line);
        color: transparent;
    }

    :root[data-sidebar="collapsed"] .dx-sidebar__brand { justify-content: center; padding: 0; }
    :root[data-sidebar="collapsed"] .dx-sidebar__home { margin: 0; }
    :root[data-sidebar="collapsed"] .dx-nav__link { justify-content: center; padding: 0; }
    :root[data-sidebar="collapsed"] .dx-nav__empty { justify-content: center; padding: 10px 0; }

    :root[data-sidebar="collapsed"] .dx-sidebar__foot {
        flex-direction: column;
        gap: 6px;
        height: auto;
        margin: 0 10px var(--dx-foot-gap);
        padding: 8px 0;
    }

    :root[data-sidebar="collapsed"] .dx-profile { flex: none; }
}

/* Name tooltip next to the narrow sidebar */
@media (min-width: 761px) and (hover: hover) {
    :root[data-sidebar="collapsed"] .dx-sidebar__nav { overflow: visible; }

    :root[data-sidebar="collapsed"] .dx-nav__link::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 14px);
        top: 50%;
        z-index: 40;
        padding: 6px 10px;
        border: 1px solid var(--dx-line);
        border-radius: var(--dx-radius-sm);
        background: var(--dx-surface);
        box-shadow: var(--dx-shadow-sm);
        color: var(--dx-text);
        font-size: var(--dx-text-xs);
        font-weight: 600;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transform: translate(-4px, -50%);
        transition: opacity .15s, transform .15s var(--dx-ease);
    }

    :root[data-sidebar="collapsed"] .dx-nav__link:hover::after {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

/* ---- Top band: workspace tabs + quick actions ---- */

.dx-topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: stretch;
    gap: 12px;
    height: var(--dx-topbar-h);
    flex: none;
    padding: 0 12px 0 0;
    border-bottom: 1px solid var(--dx-line);
    background: var(--dx-surface);
}

.dx-topbar__title { display: none; }

.dx-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.dx-tabs::-webkit-scrollbar { display: none; }

/* Flat, corporate tabs: text only, the active one underlined in the theme colour. */
.dx-tabs__tab {
    position: relative;
    display: flex;
    align-items: center;
    flex: none;
    max-width: 220px;
    border-right: 1px solid var(--dx-line);
    color: var(--dx-muted);
    transition: color .18s, background .18s;
}

.dx-tabs__tab:hover { background: color-mix(in srgb, var(--dx-surface-2) 60%, transparent); }

.dx-tabs__tab:hover { color: var(--dx-text); }
.dx-tabs__tab[aria-selected="true"] { color: var(--dx-text); }

.dx-tabs__tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: transparent;
    transition: background .18s;
}

.dx-tabs__tab:hover::after { background: var(--dx-line); }
.dx-tabs__tab[aria-selected="true"]::after { background: var(--dx-accent); }

.dx-tabs__link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 100%;
    padding: 0 14px;
    color: inherit;
    font-size: var(--dx-text-sm);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.dx-tabs__tab[aria-selected="true"] .dx-tabs__link { font-weight: 600; }
.dx-tabs__link span { overflow: hidden; text-overflow: ellipsis; }
.dx-tabs__link .dx-ico { width: 16px; height: 16px; }
.dx-tabs__tab.is-pinned .dx-tabs__link { width: 48px; padding: 0; justify-content: center; }
.dx-tabs__tab.is-pinned .dx-tabs__link .dx-ico { width: 18px; height: 18px; }
.dx-tabs__tab[aria-selected="true"] .dx-tabs__link .dx-ico { color: var(--dx-accent-text); }
.dx-tabs__tab:not(.is-pinned) .dx-tabs__link { padding-right: 2px; }
.dx-tabs__link:focus-visible { outline: 0; border-radius: 8px; box-shadow: inset var(--dx-focus-ring); }

.dx-tabs__close {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--dx-muted);
    cursor: pointer;
    opacity: .6;
}

.dx-tabs__close .dx-ico { width: 13px; height: 13px; }
.dx-tabs__close:hover { background: var(--dx-surface-2); color: var(--dx-text); opacity: 1; }
.dx-tabs__close:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); opacity: 1; }

.dx-tabs__tool {
    display: grid;
    place-items: center;
    flex: none;
    align-self: center;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    padding: 0;
    border: 1px solid var(--dx-line);
    border-radius: 8px;
    background: var(--dx-surface);
    color: var(--dx-muted);
    cursor: pointer;
}

.dx-tabs__tool .dx-ico { width: 14px; height: 14px; }
.dx-tabs__tool:hover { border-color: var(--dx-accent-line); color: var(--dx-accent-text); }

.dx-topbar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding-left: 12px;
    border-left: 1px solid var(--dx-line);
    margin: 8px 0;
}

/* Quick action icons (owner decision 2026-11-16): strong and coloured, never ghostly. Each sits on
   a soft tile of the theme colour with a bold stroke; hover, open and active fill the tile. */
.dx-topbar__actions .dx-icon-button {
    width: 34px;
    height: 34px;
    border: 1px solid color-mix(in srgb, var(--dx-accent) 26%, var(--dx-line));
    border-radius: 10px;
    background: var(--dx-accent-soft);
    color: var(--dx-accent-text);
    transition: background .18s, color .18s, border-color .18s, transform .18s var(--dx-ease);
}

.dx-topbar__actions .dx-icon-button svg {
    width: 19px;
    height: 19px;
    stroke-width: 2.1;
}

:root[data-theme="dark"] .dx-topbar__actions .dx-icon-button {
    border-color: color-mix(in srgb, var(--dx-accent) 40%, var(--dx-line));
    background: color-mix(in srgb, var(--dx-accent) 24%, var(--dx-surface));
    color: color-mix(in srgb, var(--dx-accent) 55%, #fff);
}

.dx-topbar__actions .dx-icon-button:hover,
.dx-topbar__actions .dx-icon-button[aria-expanded="true"],
.dx-topbar__actions .dx-icon-button.is-active,
:root[data-theme="dark"] .dx-topbar__actions .dx-icon-button:hover,
:root[data-theme="dark"] .dx-topbar__actions .dx-icon-button[aria-expanded="true"],
:root[data-theme="dark"] .dx-topbar__actions .dx-icon-button.is-active {
    border-color: var(--dx-accent);
    background: var(--dx-accent);
    color: var(--dx-on-accent);
}

.dx-topbar__actions .dx-icon-button:hover { transform: translateY(-1px); }

/* Kontrol Merkezi gear: its own group, always filled so the administration entry stands out. */
.dx-topbar__actions .dx-topbar__control,
:root[data-theme="dark"] .dx-topbar__actions .dx-topbar__control {
    border-color: transparent;
    background: var(--dx-accent-gradient);
    color: var(--dx-on-accent);
    box-shadow: 0 6px 16px -8px var(--dx-accent);
}

.dx-topbar__actions .dx-topbar__control:hover,
.dx-topbar__actions .dx-topbar__control.is-active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--dx-accent) 25%, transparent); }

.dx-topbar__divider {
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: var(--dx-line);
}

/* Phone: the gear sits next to the profile in the drawer instead of the band. */
.dx-side-button--control { display: none; }

@media (max-width: 760px) {
    .dx-topbar__control,
    .dx-topbar__divider { display: none; }

    .dx-side-button--control { display: grid; color: var(--dx-accent-text); }
    .dx-side-button--control:hover { background: var(--dx-accent-soft); color: var(--dx-accent-text); }
}

.dx-menu-anchor { position: relative; }

/* Popovers */
.dx-popover {
    position: absolute;
    z-index: 50;
    padding: 8px;
    border: 1px solid var(--dx-line);
    border-radius: 16px;
    background: var(--dx-surface);
    box-shadow: var(--dx-shadow);
    animation: dx-pop .16s var(--dx-ease);
}

.dx-popover--end { top: calc(100% + 10px); right: 0; }

@keyframes dx-pop {
    from { opacity: 0; transform: translateY(-4px) scale(.98); }
}

.dx-popover__title {
    margin: 6px 10px 8px;
    color: var(--dx-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.dx-popover-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

.dx-notifications { width: 340px; }

.dx-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 22px 16px 26px;
    color: var(--dx-muted);
    font-size: var(--dx-text-sm);
    text-align: center;
}

.dx-empty strong { color: var(--dx-text); font-size: var(--dx-text-md); font-weight: 650; }

.dx-empty__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    border-radius: 15px;
    background: var(--dx-accent-soft);
    color: var(--dx-accent-text);
}

/* ---- Phone bottom menu ---- */

.dx-bottom-nav { display: none; }

/* ---- Workspace primitives ---- */

.dx-page {
    max-width: 1320px;
    margin: 0 auto;
}

.dx-page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.dx-page__title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.dx-page__lead {
    max-width: 680px;
    margin: 6px 0 0;
    color: var(--dx-muted);
    font-size: var(--dx-text-md);
    line-height: 1.55;
}

.dx-card {
    padding: 22px;
    border: 1px solid var(--dx-line);
    border-radius: var(--dx-radius-lg);
    background: var(--dx-surface);
    box-shadow: 0 1px 2px rgba(15, 30, 60, .04);
}

.dx-card__head { margin-bottom: 18px; }

.dx-card__title {
    margin: 0;
    font-size: var(--dx-text-lg);
    font-weight: 650;
    letter-spacing: -.01em;
}

.dx-card__lead {
    margin: 4px 0 0;
    color: var(--dx-muted);
    font-size: var(--dx-text-sm);
    line-height: 1.5;
}

.dx-card__note {
    margin: 14px 0 0;
    color: var(--dx-success);
    font-size: var(--dx-text-sm);
    font-weight: 550;
}

.dx-card__note.is-error { color: var(--dx-danger); }

.dx-input {
    height: 38px;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid var(--dx-line);
    border-radius: 10px;
    background: var(--dx-surface);
    color: var(--dx-text);
    font: 500 var(--dx-text-md) var(--dx-font);
    transition: border-color .2s, box-shadow .2s;
}

.dx-input:focus { outline: 0; border-color: var(--dx-accent); box-shadow: var(--dx-focus-ring); }

.dx-inline-field { display: flex; gap: 8px; }

.dx-form-error {
    margin: 10px 0 0;
    color: var(--dx-danger);
    font-size: var(--dx-text-sm);
}

.dx-button--sm {
    min-height: 38px;
    padding: 0 14px;
    font-size: var(--dx-text-sm);
}

.dx-radio {
    width: 18px;
    height: 18px;
    flex: none;
    border: 2px solid var(--dx-line);
    border-radius: 50%;
    background: var(--dx-surface);
    transition: border-color .2s, box-shadow .2s;
}

[aria-checked="true"] > * > .dx-radio,
[aria-checked="true"] .dx-radio {
    border-color: var(--dx-accent);
    box-shadow: inset 0 0 0 3px var(--dx-surface), inset 0 0 0 9px var(--dx-accent);
}

/* ---- Personalisation controls ---- */

.dx-mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.dx-mode-option {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--dx-line);
    border-radius: 16px;
    background: var(--dx-surface);
    color: var(--dx-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.dx-mode-option:hover { border-color: var(--dx-accent-line); }
.dx-mode-option[aria-checked="true"] { border-color: var(--dx-accent); box-shadow: var(--dx-focus-ring); }
.dx-mode-option:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

/* Illustrations of each mode: they show that mode's own surfaces whatever mode is active
   (values mirror the light and dark tokens in dex-theme.css). */
.dx-mode-option--light { --art-bg: #ffffff; --art-surface: #ffffff; --art-surface-2: #edf2f8; --art-line: #dae3ee; --art-text: #c5d0dd; }
.dx-mode-option--dark { --art-bg: #0c1422; --art-surface: #0c1422; --art-surface-2: #111b2d; --art-line: #1b2940; --art-text: #2a3a55; }

.dx-mode-option__art {
    display: flex;
    height: 116px;
    overflow: hidden;
    border: 1px solid var(--art-line);
    border-radius: 11px;
    background: var(--art-bg);
}

.dx-mode-option__side {
    width: 26%;
    border-right: 1px solid color-mix(in srgb, var(--dx-accent) 30%, var(--art-line));
    background: color-mix(in srgb, var(--dx-accent) 8%, var(--art-surface-2));
}

.dx-mode-option__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 12px;
}

.dx-mode-option__bar {
    height: 18px;
    margin: 0 -12px 4px;
    border-bottom: 1px solid var(--art-line);
    background: var(--art-surface);
}

.dx-mode-option__line {
    height: 8px;
    width: 72%;
    border-radius: 4px;
    background: var(--art-text);
}

.dx-mode-option__line--short { width: 46%; }

.dx-mode-option__chip {
    width: 40%;
    height: 18px;
    margin-top: auto;
    border-radius: 6px;
    background: var(--dx-accent);
}

.dx-mode-option__label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 2px;
    font-size: var(--dx-text-md);
    font-weight: 600;
}

.dx-swatches {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.dx-swatch {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--dx-line);
    border-radius: 14px;
    background: var(--dx-surface);
    color: var(--dx-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s var(--dx-ease);
}

.dx-swatch:hover { border-color: color-mix(in srgb, var(--swatch) 50%, var(--dx-line)); transform: translateY(-1px); }
.dx-swatch:focus-visible { outline: 0; box-shadow: var(--dx-focus-ring); }

.dx-swatch[aria-checked="true"] {
    border-color: var(--swatch);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch) 22%, transparent);
}

.dx-swatch__color {
    display: grid;
    place-items: center;
    grid-row: span 2;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--swatch);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.dx-swatch__color .dx-ico {
    width: 17px;
    height: 17px;
    stroke-width: 2.4;
    opacity: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35));
}

.dx-swatch[aria-checked="true"] .dx-swatch__color .dx-ico { opacity: 1; }
.dx-swatch__name { font-size: var(--dx-text-sm); font-weight: 600; }
.dx-swatch__hex { color: var(--dx-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.dx-custom-color {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px dashed var(--dx-line);
    border-radius: 14px;
}

.dx-custom-color.is-selected { border-style: solid; border-color: var(--dx-accent); }

.dx-custom-color__picker {
    position: relative;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 11px;
    background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #06b6d4, #6366f1, #d946ef, #f43f5e);
    cursor: pointer;
}

.dx-custom-color.is-selected .dx-custom-color__picker { background: var(--dx-accent); box-shadow: 0 0 0 3px var(--dx-accent-soft); }

.dx-custom-color__picker input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.dx-custom-color__text {
    display: flex;
    flex: 1 1 220px;
    flex-direction: column;
    min-width: 0;
}

.dx-custom-color__text strong { font-size: var(--dx-text-sm); font-weight: 650; }
.dx-custom-color__text span { color: var(--dx-muted); font-size: var(--dx-text-xs); }
.dx-inline-field--hex .dx-input { width: 116px; font-variant-numeric: tabular-nums; text-transform: lowercase; }

.dx-company-theme {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 14px;
    background: var(--dx-surface-2);
}

.dx-company-theme__swatch {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: var(--swatch);
}

.dx-company-theme__text {
    display: flex;
    flex: 1 1 200px;
    flex-direction: column;
}

.dx-company-theme__text strong { font-size: var(--dx-text-md); font-weight: 650; }
.dx-company-theme__text span { color: var(--dx-muted); font-size: var(--dx-text-sm); }
.dx-company-theme__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.dx-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--dx-accent-soft);
    color: var(--dx-accent-text);
    font-size: var(--dx-text-sm);
    font-weight: 600;
}

.dx-status-pill .dx-ico { width: 16px; height: 16px; stroke-width: 2.2; }

/* ---- Personalisation panel ----
   Slides in from the right over the open screen; the screen stays visible and repaints at once,
   so it is the preview. Phones get a bottom sheet. */

.dx-panel-scrim {
    position: fixed;
    inset: var(--dx-topbar-h) 0 0 0;
    z-index: 79;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

.dx-panel {
    position: fixed;
    top: calc(var(--dx-topbar-h) + 8px);
    right: 10px;
    z-index: 80;
    max-height: calc(100dvh - var(--dx-topbar-h) - 18px);
    display: flex;
    flex-direction: column;
    width: min(392px, calc(100vw - 20px));
    border: 1px solid var(--dx-side-line);
    border-radius: 18px;
    background: var(--dx-surface);
    box-shadow: 0 30px 80px -24px rgba(10, 20, 40, .35), 0 0 0 1px color-mix(in srgb, var(--dx-surface) 40%, transparent);
    outline: 0;
    animation: dx-panel-in .26s var(--dx-ease);
}

:root[data-theme="dark"] .dx-panel { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); }

@media (display-mode: window-controls-overlay) {
    .dx-panel {
        top: calc(env(titlebar-area-height, 0px) + var(--dx-topbar-h) + 8px);
        max-height: calc(100dvh - env(titlebar-area-height, 0px) - var(--dx-topbar-h) - 18px);
    }
    .dx-panel-scrim { top: calc(env(titlebar-area-height, 0px) + var(--dx-topbar-h)); }
}

@keyframes dx-panel-in {
    from { opacity: 0; transform: translateX(24px); }
}

.dx-panel__grip { display: none; }

/* Everything fits without scrolling, like the sidebar; compact sizes keep it so down to
   ~600px-high windows (the body only scrolls as a last resort on smaller ones). */
.dx-panel__head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    padding: 14px 12px 12px 18px;
    border-bottom: 1px solid var(--dx-line);
}

.dx-panel__head > div { flex: 1; min-width: 0; }

.dx-panel__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.dx-panel__lead {
    margin: 2px 0 0;
    color: var(--dx-muted);
    font-size: var(--dx-text-xs);
}

.dx-panel__close {
    width: 30px;
    height: 30px;
    border-color: transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--dx-muted);
}

.dx-panel__close:hover { border-color: var(--dx-line); background: var(--dx-surface-2); }

.dx-panel__body {
    display: grid;
    align-content: start;
    gap: 18px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 18px 16px;
    scrollbar-width: thin;
}

.dx-panel__section-title {
    margin: 0 0 8px;
    color: var(--dx-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Controls sized for the panel */
.dx-panel .dx-mode-options { gap: 8px; }
.dx-panel .dx-mode-option { gap: 7px; padding: 6px; border-radius: 11px; }
.dx-panel .dx-mode-option__art { height: 58px; border-radius: 7px; }
.dx-panel .dx-mode-option__body { gap: 5px; padding: 0 8px 8px; }
.dx-panel .dx-mode-option__bar { height: 12px; margin: 0 -8px 2px; }
.dx-panel .dx-mode-option__line { height: 5px; }
.dx-panel .dx-mode-option__chip { height: 12px; border-radius: 4px; }
.dx-panel .dx-mode-option__label { gap: 8px; padding: 0 2px 1px; font-size: var(--dx-text-sm); }
.dx-panel .dx-radio { width: 15px; height: 15px; }
.dx-panel [aria-checked="true"] .dx-radio { box-shadow: inset 0 0 0 2px var(--dx-surface), inset 0 0 0 8px var(--dx-accent); }

.dx-panel .dx-swatches { gap: 6px; }

.dx-panel .dx-swatch {
    display: flex;
    gap: 7px;
    padding: 5px 7px;
    border-radius: 9px;
}

.dx-panel .dx-swatch:hover { transform: none; }
.dx-panel .dx-swatch__color { width: 22px; height: 22px; border-radius: 7px; }
.dx-panel .dx-swatch__color .dx-ico { width: 13px; height: 13px; }
.dx-panel .dx-swatch__name { overflow: hidden; font-size: var(--dx-text-xs); white-space: nowrap; text-overflow: ellipsis; }

.dx-panel .dx-custom-color {
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 8px;
    padding: 6px;
    border-radius: 10px;
}

.dx-panel .dx-custom-color__picker { width: 28px; height: 28px; border-radius: 8px; }

.dx-custom-color__label {
    flex: 1;
    min-width: 0;
    font-size: var(--dx-text-xs);
    font-weight: 600;
    white-space: nowrap;
}

.dx-panel .dx-custom-color .dx-input {
    width: 92px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: var(--dx-text-sm);
    font-variant-numeric: tabular-nums;
    text-transform: lowercase;
}

.dx-panel .dx-button--sm { min-height: 30px; padding: 0 12px; border-radius: 8px; font-size: var(--dx-text-xs); }

.dx-panel .dx-company-theme { flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; border-radius: 10px; }
.dx-panel .dx-company-theme__swatch { width: 28px; height: 28px; border-radius: 8px; }
.dx-panel .dx-company-theme__text { flex: 1 1 0; min-width: 0; line-height: 1.3; }
.dx-panel .dx-company-theme__text strong { font-size: var(--dx-text-sm); }
.dx-panel .dx-company-theme__text span { font-size: var(--dx-text-xs); }
.dx-panel .dx-company-theme__actions { flex-wrap: nowrap; gap: 6px; width: 100%; }
.dx-panel .dx-company-theme__actions .dx-button { flex: 1; }
.dx-panel .dx-status-pill { height: 28px; font-size: var(--dx-text-xs); }
.dx-panel .dx-card__note { margin-top: 8px; font-size: var(--dx-text-xs); }

/* Short windows (small laptops, small phones): the mode cards drop their illustration. */
@media (max-height: 620px) {
    .dx-panel .dx-mode-option__art { display: none; }
    .dx-panel .dx-mode-option { padding: 8px 10px; }
    .dx-panel__body { gap: 14px; padding-top: 12px; }
}

/* ---- Tablet: the sidebar is always narrow ---- */
@media (min-width: 761px) and (max-width: 1180px) {
    .dx-shell { --dx-side: var(--dx-sidebar-narrow-w); }

    .dx-sidebar__name,
    .dx-sidebar__label,
    .dx-profile__text,
    .dx-nav__empty span { display: none; }

    .dx-nav__title {
        height: 1px;
        margin: 12px 14px;
        overflow: hidden;
        background: var(--dx-side-line);
        color: transparent;
    }

    .dx-sidebar__brand { justify-content: center; padding: 0; }
    .dx-sidebar__home { margin: 0; pointer-events: none; }
    .dx-nav__link { justify-content: center; padding: 0; }
    .dx-nav__empty { justify-content: center; padding: 10px 0; }
    .dx-sidebar__foot { flex-direction: column; gap: 6px; height: auto; margin: 0 10px var(--dx-foot-gap); padding: 8px 0; }
    .dx-profile { flex: none; }
    .dx-workspace { padding: 24px; }
}

/* ---- Phone: drawer, bottom menu, single-screen flow ---- */
@media (max-width: 760px) {
    .dx-shell { grid-template-columns: minmax(0, 1fr); }

    .dx-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: min(320px, 86vw);
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border-radius: 0 22px 22px 0;
        background: var(--dx-side-bg);
        box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
        transform: translateX(-104%);
        transition: transform .3s var(--dx-ease);
    }

    .is-drawer-open .dx-sidebar { transform: none; }
    .dx-sidebar__close { display: grid; }
    .dx-sidebar__home { pointer-events: none; }
    .dx-sidebar__brand { height: 60px; }
    .dx-nav__link { height: 46px; }

    .dx-shell__scrim {
        position: fixed;
        inset: 0;
        z-index: 65;
        display: block;
        padding: 0;
        border: 0;
        background: rgba(4, 10, 20, .48);
        backdrop-filter: blur(2px);
        animation: dx-fade .2s ease;
    }

    @keyframes dx-fade { from { opacity: 0; } }

    .dx-topbar {
        align-items: center;
        height: calc(58px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 10px 0 16px;
    }

    .dx-topbar__title {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
    }

    .dx-topbar__mark { display: grid; place-items: center; flex: none; }
    .dx-topbar__logo { width: 30px; }

    .dx-topbar__screen {
        overflow: hidden;
        font-size: 17px;
        font-weight: 700;
        letter-spacing: -.01em;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .dx-tabs { display: none; }
    .dx-topbar__actions { margin: 0; padding-left: 0; border-left: 0; }
    .dx-topbar__personalise { display: none; }

    .dx-popover--end { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; width: auto; }

    .dx-workspace {
        padding: 20px 16px calc(var(--dx-bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px));
        scrollbar-gutter: auto;
    }

    .dx-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        height: calc(var(--dx-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
        padding: 6px 8px env(safe-area-inset-bottom, 0px);
        border-top: 1px solid var(--dx-line);
        background: color-mix(in srgb, var(--dx-surface) 88%, transparent);
        backdrop-filter: blur(18px) saturate(150%);
        -webkit-backdrop-filter: blur(18px) saturate(150%);
    }

    .dx-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--dx-muted);
        font: 600 11px var(--dx-font);
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .dx-bottom-nav__item .dx-ico {
        width: 46px;
        height: 30px;
        padding: 5px 13px;
        border-radius: 999px;
        transition: background .2s;
    }

    .dx-bottom-nav__item.is-active { color: var(--dx-accent-text); }
    .dx-bottom-nav__item.is-active .dx-ico { background: var(--dx-accent-soft); }

    .dx-page__head { margin-bottom: 16px; }
    .dx-page__title { font-size: 22px; }
    .dx-card { padding: 18px 16px; border-radius: 16px; }

    /* Personalisation: bottom sheet */
    .dx-panel-scrim { inset: 0; background: rgba(4, 10, 20, .32); animation: dx-fade .2s ease; }

    .dx-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-height: 88dvh;
        border-width: 1px 0 0;
        border-radius: 22px 22px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: dx-sheet-in .28s var(--dx-ease);
    }

    @keyframes dx-sheet-in { from { transform: translateY(40px); opacity: 0; } }

    .dx-panel__grip {
        position: absolute;
        top: 7px;
        left: 50%;
        display: block;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 4px;
        background: var(--dx-line);
    }

    .dx-panel__head { padding-top: 22px; }
    .dx-mode-options { gap: 10px; }
    .dx-mode-option__art { height: 92px; }
    .dx-inline-field--hex { width: 100%; }
    .dx-inline-field--hex .dx-input { flex: 1; }
    .dx-company-theme__actions { width: 100%; }
    .dx-company-theme__actions .dx-button { flex: 1; }
}

/* The install button must not cover the tab band or the bottom menu. */
body:has(.dx-shell) .pwa-install-button {
    top: auto;
    right: 24px;
    bottom: 24px;
}

@media (max-width: 760px) {
    body:has(.dx-shell) .pwa-install-button {
        right: 16px;
        bottom: calc(var(--dx-bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px));
    }
}
