body.shell {
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

body.shell { --rail-width: 320px; }

.shell-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: var(--dark);
    border-bottom: 1px solid var(--dark-border);
    border-radius: 0;
    display: grid;
    grid-template-columns: 1fr var(--rail-width);
    align-items: stretch;
    z-index: 1000;
}

.shell-header > nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    padding: 0 24px;
}

.shell-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 54px;
}

.shell-nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.shell-nav-link {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--nav-rest);
    text-decoration: none;
    white-space: nowrap;
    transition: color .12s ease;
}

.shell-nav-link:hover  { color: var(--nav-hover); }
.shell-nav-link.active { color: var(--nav-active); } 

.shell-nav-caret { margin-left: 3px; font-size: 11px; }
.shell-nav-caret::before { content: '▾'; }  
.shell-nav-item:hover        .shell-nav-caret::before,
.shell-nav-item:focus-within .shell-nav-caret::before,
.shell-nav-item.open         .shell-nav-caret::before { content: '▴'; }

.shell-nav-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: max-content;
    background: var(--dark);
    border: 1px solid var(--dark-border);
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
    padding: 6px 0;
    margin: 0;
    list-style: none;
    z-index: 1001;
}

.shell-nav-item:hover .shell-nav-drop,
.shell-nav-item:focus-within .shell-nav-drop,
.shell-nav-item.open .shell-nav-drop { display: block; }

.shell-nav-drop li {
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--nav-rest);
    padding: 9px 18px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .12s ease;
}

.shell-nav-drop li:hover     { color: var(--nav-hover); }
.shell-nav-drop li.selected  { color: var(--nav-active); }

.shell-switcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 54px;
    padding: 0 24px;
    border-left: 1px solid var(--dark-border);
}

.switcher-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.switcher-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: .5;
    transition: opacity .12s ease;
}

.switcher-item:hover,
.switcher-item.is-current { opacity: 1; }

.switcher-item .ring {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid transparent;  
}

.switcher-item.is-current .ring { border-color: var(--select-ring); }

.switcher-trigger {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.switcher-trigger:hover { opacity: .8; }

.shell-icon {
    display: inline-block;
    flex-shrink: 0;
    color: #f5f5f5;
}

.shell-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.switcher-caret {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--dark-text-muted);
    line-height: 1;
}

body.shell-narrow .shell-header   { grid-template-columns: 1fr auto; }
body.shell-narrow .shell-switcher { border-left: none; padding: 0 18px; }
body.shell-narrow .switcher-icons   { display: none; }
body.shell-narrow .switcher-trigger { display: flex; }

.switcher-panel {
    position: fixed;
    background: var(--overlay-bg);
    -webkit-backdrop-filter: var(--overlay-blur);
    backdrop-filter: var(--overlay-blur);
    border: 1px solid var(--dark-border);
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
    padding: 14px 16px 16px;
    min-width: 210px;
    max-width: 290px;
    z-index: 1001;
    user-select: none;
    animation: overlay-in .14s ease-out;
}

.switcher-panel__app {
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: #f5f5f5;
}

.switcher-panel__app-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dark-text-muted);
    margin-top: 2px;
}

.feature-group { margin-top: 11px; }

.feature-group__label {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: #e6e8ec;
}

.feature-group__items {
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--dark-text-muted);
    margin-top: 2px;
    padding-left: 13px;
}

.switcher-panel__auth {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--dark-border);
    user-select: auto;
}

#shell-notices {
    position: fixed;
    top: 54px;
    left: 0;
    right: 0;
    z-index: 950;
}

.shell-notice {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 10px;
    padding: 6px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent-dim);
    background: #edf3f9;
    border-bottom: 1px solid #d3e2ef;
    text-align: center;
}

.shell-notice--danger {
    color: var(--danger);
    background: #fdf4f3;
    border-bottom-color: #e8c4bf;
}

.shell-notice-dismiss {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: inherit;
    opacity: .7;
    cursor: pointer;
    white-space: nowrap;
}

.shell-notice-dismiss:hover { opacity: 1; }

.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(40, 44, 52, .25);
    z-index: 1100;
}

.overlay-backdrop--modal { background: rgba(40, 44, 52, .35); }

.overlay {
    position: fixed;
    background: var(--overlay-bg);
    -webkit-backdrop-filter: var(--overlay-blur);
    backdrop-filter: var(--overlay-blur);
    border: 1px solid var(--dark-border);
    border-radius: 0 0 2px 2px;
    color: #f5f5f5;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 74px);
    z-index: 1101;
}

.overlay__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--dark-border);
    flex-shrink: 0;
}

.overlay__title {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--dark-text-muted);
}

.overlay__close {
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dark-text-muted);
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}

.overlay__close:hover { color: #f5f5f5; }

.overlay__body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.overlay__footer {
    display: flex;
    justify-content: flex-end;
    gap: 22px;
    padding: 12px 16px;
    border-top: 1px solid var(--dark-border);
    flex-shrink: 0;
}

.overlay--popover {
    width: 520px;
    max-width: calc(100vw - 24px);
    animation: overlay-in .14s ease-out;
}

.overlay--modal {
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    max-width: calc(100vw - 32px);
    animation: overlay-in-modal .14s ease-out;
}

.overlay--drawer {
    top: 54px;
    right: 0;
    bottom: 0;
    width: 330px;
    max-width: calc(100vw - 24px);
    max-height: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
    border-radius: 0;
    animation: overlay-in-drawer .14s ease-out;
}

@keyframes overlay-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes overlay-in-modal {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes overlay-in-drawer {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.overlay-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--dark-text-muted);
    margin-bottom: 5px;
}

.overlay select {
    width: 100%;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--dark-border-hover);
    border-radius: var(--radius);
    color: #f5f5f5;
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 7px 9px;
}

.overlay-btn {
    background: none;
    border: none;
    padding: 2px 0;
    font-family: var(--font-mono);
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .12s ease;
}

.overlay-btn--ghost { color: #8f96a3; }
.overlay-btn--ghost:hover { color: #e6e8ec; }

.overlay-btn--primary { color: var(--link-d); } 
.overlay-btn--primary:hover { color: var(--link-d-hover); }

.launcher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.launcher-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .04);
    text-decoration: none;
    cursor: pointer;
}

.launcher-tile:hover {
    background: rgba(255, 255, 255, .09);
    border-color: var(--dark-border-hover);
}

.launcher-tile.is-current {
    border-color: var(--accent);
    background: rgba(125, 122, 255, .13);
}


.launcher-tile-name {
    font-family: var(--font-mono);
    font-size: 14.5px;
    color: #f5f5f5;
    display: block;
}

.launcher-tile.is-current .launcher-tile-name { color: var(--accent-soft); }

.launcher-tile-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dark-text-muted);
    display: block;
    margin-top: 2px;
}

.launcher-system {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 4px 0;
    border-top: 1px dashed var(--dark-border);
    text-decoration: none;
    cursor: pointer;
}

.launcher-system__link:hover .launcher-tile-name { color: var(--accent-soft); }


.launcher-system-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dark-text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.launcher-system {
    display: block;
    padding: 12px 4px 0;
}

.launcher-system__link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
}

.launcher-session {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--dark-border);
}

.launcher-session__label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--dark-text-muted);
}

.launcher-auth {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.launcher-auth button {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--link-d);
    cursor: pointer;
    transition: color .12s ease;
}

.launcher-auth button:hover { color: var(--link-d-hover); }

.shell-main {
    display: flex;
    align-items: stretch;
    margin-top: calc(54px + var(--notice-height, 0px));
    height: calc(100vh - 104px - var(--notice-height, 0px));
    overflow: hidden;
}

.shell-content {
    width: min(var(--content-width, 1100px), 100%);
    flex-shrink: 1;
    padding: 38px 40px;
    height: 100%;
    overflow-y: auto;
    direction: rtl;
}

.shell-content > * {
    direction: ltr;
}

.shell-content main {
    height: 100%;
}

.shell-gap {
    flex: 1 1 0;
    min-width: 0;
    background: linear-gradient(
        to right,
        transparent,
        color-mix(in srgb, var(--accent) 42%, transparent));
}

body.shell-narrow .shell-gap { display: none; }

.shell-rail {
    width: var(--rail-width);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.rail-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--label-fg);
    margin-bottom: 10px;
}

.rail-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 28px;
}

.rail-btn {
    background: none;
    border: none;
    padding: 2px 0;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--link-label);
    text-align: left;
    cursor: pointer;
    transition: color .12s ease;
}

.rail-btn::before { content: '[ '; color: var(--link-bracket); }
.rail-btn::after  { content: ' ]'; color: var(--link-bracket); }

.rail-btn:hover,
.rail-btn:hover::before,
.rail-btn:hover::after { color: var(--link-hover); }

.rail-btn--danger { color: var(--text-light); }
.rail-btn--danger::before,
.rail-btn--danger::after { color: var(--text-light); }
.rail-btn--danger:hover,
.rail-btn--danger:hover::before,
.rail-btn--danger:hover::after { color: var(--danger); }

.rail-section { margin-bottom: 28px; }

.rail-msgs {
    min-height: 84px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-card {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    border: 1px solid;
    border-radius: 0;
    padding: 8px 10px;
    animation: msg-in .18s ease-out;
    word-break: break-word;
}

.msg-card-text { flex: 1; }

.msg-card-dismiss {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: inherit;
    opacity: .55;
    cursor: pointer;
}

.msg-card-dismiss:hover { opacity: 1; }
.msg-card--ok    { color: var(--log-ok-fg);   border-color: var(--log-ok-bd);   background: var(--log-ok-bg); }
.msg-card--error { color: var(--log-err-fg);  border-color: var(--log-err-bd);  background: var(--log-err-bg); }
.msg-card--info  { color: var(--log-info-fg); border-color: var(--log-info-bd); background: var(--log-info-bg); }
.msg-card > span:first-child { font-weight: 700; }

@keyframes msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rail-spacer { flex: 1; }

.rail-hint {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 14px;
    font-family: var(--font);
    font-style: italic;
    font-size: 13.5px;
    color: var(--text-muted);
}

.rail-hint:empty { display: none; }

body.shell-narrow .shell-rail { display: none; }

.rail-tab {
    display: none;
    position: fixed;
    right: 0;
    top: calc(78px + var(--notice-height, 0px));
    writing-mode: vertical-rl;
    background: var(--dark);
    color: #f5f5f5;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-family: var(--font-mono);
    font-size: 11.5px;
    padding: 12px 6px;
    cursor: pointer;
    z-index: 990;
}

body.shell-narrow .rail-tab { display: block; }

.rail-tab.flash { animation: rail-tab-flash .6s ease-out; }

@keyframes rail-tab-flash {
    0%   { background: var(--accent); }
    100% { background: var(--dark); }
}

.shell-edge-fade {
    display: none;
    position: fixed;
    top: 54px;
    right: 0;
    bottom: 0;
    width: 14px;
    background: linear-gradient(to left, rgba(0, 0, 0, .07), transparent);
    pointer-events: none;
    z-index: 980;
}

body.shell-narrow .shell-edge-fade { display: block; }

.overlay--drawer .rail-label { color: var(--dark-text-muted); }

.overlay--drawer .rail-btn,
.overlay--drawer .rail-btn::before,
.overlay--drawer .rail-btn::after { color: var(--link-d); }
.overlay--drawer .rail-btn:hover,
.overlay--drawer .rail-btn:hover::before,
.overlay--drawer .rail-btn:hover::after { color: var(--link-d-hover); }

.overlay--drawer .rail-btn--danger,
.overlay--drawer .rail-btn--danger::before,
.overlay--drawer .rail-btn--danger::after { color: var(--dark-text-muted); }
.overlay--drawer .rail-btn--danger:hover,
.overlay--drawer .rail-btn--danger:hover::before,
.overlay--drawer .rail-btn--danger:hover::after { color: #e07b6e; }

.overlay--drawer .rail-msgs {
    border-top: 1px solid var(--dark-border);
    padding-top: 16px;
    margin-top: 4px;
}

.overlay--drawer .rail-section {
    border-top: 1px solid var(--dark-border);
    padding-top: 16px;
}

.overlay--drawer .rail-hint {
    border-top-color: var(--dark-border);
    color: var(--dark-text-muted);
}

@media (prefers-reduced-motion: reduce) {
    .overlay, .msg-card, .rail-tab.flash { animation: none !important; }
    .shell-nav-link, .shell-nav-drop li, .rail-btn, .overlay-btn { transition: none; }
}
