/* Nook — app shell */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 2.4rem 0 1.6rem;
    background: var(--color-sidebar-bg);
    color: #fff;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.app-main {
    flex: 1;
    min-width: 0;
    background: var(--color-bg);
}

.app-content {
    padding: 2.8rem 3.2rem 4.8rem;
    max-width: none;
}

.app-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-top: 1.6rem;
    padding: 1.6rem 0 8px 0;
    border-top: 1px solid #333;
}

.app-nav > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.88rem;
    padding: 0.88rem 1.2rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.52rem;
    position: relative;
    border-left: 8px solid transparent;
}

.app-nav-icon {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.app-nav-link:hover,
.app-nav-link:focus-visible {
    background: #2a2a2a;
    color: #fff;
    outline: none;
    border-left: 8px solid rgba(255, 255, 255, 0.88);
}

.app-nav-link.is-active {
    background: transparent;
    color: #fff;
    border-left-color: var(--color-highlight);
}

.app-nav-link.is-active:hover,
.app-nav-link.is-active:focus-visible {
    background: #2a2a2a;
    color: #fff;
}

.app-nav li.add-divider::after {
    content: '';
    display: block;
    border-top: 1px solid #333;
    margin: 0.8rem 1.6rem;
}

.app-nav-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 1.04rem 1.2rem 0.4rem;
    height: 0;
}

.app-nav-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 2.16rem;
    user-select: none;
}

.app-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 0.56rem;
    margin-top: auto;
    padding: 1.6rem 2rem 0;
    border-top: 1px solid #333;
    font-size: 1.44rem;
}
.brand-row {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0 2rem;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0;
    flex: 1;
    min-width: 0;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    font-size: 1.68rem;
    letter-spacing: 0.01em;
}

.brand-site-mode {
    display: inline-flex;
    flex-shrink: 0;
    opacity: 0.78;
}

.brand-site-mode-icon {
    width: 1.76rem;
    height: 1.76rem;
}

.brand-beta {
    font-size: 0.52em;
    font-weight: 600;
    letter-spacing: 0.05em;
    vertical-align: super;
    line-height: 0;
    margin-left: 0.12em;
    opacity: 0.72;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.nav-user-profile {
    display: flex;
    align-items: center;
    gap: 0.96rem;
    flex: 1;
    min-width: 0;
    padding: 0.72rem 0.8rem;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    position: relative;
    border-left: 8px solid transparent;
}

.nav-user-profile:hover,
.nav-user-profile:focus-visible {
    background: #2a2a2a;
    color: #fff;
    outline: none;
}

.nav-user-profile.is-active {
    background: transparent;
    color: #fff;
    border-left-color: var(--color-highlight);
}

.nav-user-profile.is-active:hover,
.nav-user-profile.is-active:focus-visible {
    background: #2a2a2a;
    color: #fff;
}

.nav-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #333;
}

.nav-user-logout-form {
    display: flex;
    margin: 0;
    flex-shrink: 0;
}

.nav-user-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.64rem;
    border: none;
    background: transparent;
    color: #71717a;
    border-radius: 4px;
    cursor: pointer;
    line-height: 0;
}

.nav-user-logout:hover {
    color: #fff;
    background: #2a2a2a;
}

.nav-user-logout-icon {
    display: block;
}

.app-sidebar-settings {
    display: flex;
    align-items: center;
    gap: 0.88rem;
    flex: 1;
    min-width: 0;
    padding: 0.72rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.88);
    position: relative;
    border-left: 8px solid transparent;
}

.app-sidebar-settings:hover,
.app-sidebar-settings:focus-visible {
    background: #2a2a2a;
    color: #fff;
    outline: none;
}

.app-sidebar-settings.is-active {
    background: transparent;
    color: #fff;
    border-left-color: var(--color-highlight);
}

.app-sidebar-settings.is-active:hover,
.app-sidebar-settings.is-active:focus-visible {
    background: #2a2a2a;
    color: #fff;
}

.app-sidebar-foot-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.app-sidebar-help {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.64rem;
    border-radius: 4px;
    text-decoration: none;
    color: #71717a;
    line-height: 0;
}

.app-sidebar-help:hover,
.app-sidebar-help:focus-visible {
    color: #fff;
    background: #2a2a2a;
    outline: none;
}

.app-sidebar-help.is-active {
    background: var(--color-highlight);
    color: #000;
    color: var(--color-highlight-text);
}

.app-sidebar-help-icon {
    display: block;
}

.app-sidebar-compact-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.64rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    border-radius: 4px;
    cursor: pointer;
    line-height: 0;
    flex-shrink: 0;
}

.app-sidebar-compact-toggle:hover {
    color: #fff;
    background: #2a2a2a;
}

.app-sidebar-compact-toggle-icon {
    display: block;
    transition: transform 0.15s ease;
}

.app-shell.is-sidebar-compact .app-sidebar-compact-toggle-icon {
    transform: rotate(180deg);
}

@media (min-width: 901px) {
    .app-sidebar-compact-toggle {
        display: flex;
    }

    .app-shell.is-sidebar-compact .app-sidebar {
        flex: 0 0 6.4rem;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .app-shell.is-sidebar-compact .brand-row {
        justify-content: center;
        padding: 0;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .brand {
        display: none;
    }

    .app-shell.is-sidebar-compact .app-sidebar-compact-toggle {
        padding: 0.88rem 0.56rem;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .brand-text,
    .app-shell.is-sidebar-compact .brand-beta,
    .app-shell.is-sidebar-compact .app-nav-label,
    .app-shell.is-sidebar-compact .nav-user-name,
    .app-shell.is-sidebar-compact .app-sidebar-settings-label,
    .app-shell.is-sidebar-compact .app-nav-empty {
        display: none;
    }

    .app-shell.is-sidebar-compact .app-nav {
        padding-left: 0;
        padding-right: 0;
    }

    .app-shell.is-sidebar-compact .app-nav-link,
    .app-shell.is-sidebar-compact .app-sidebar-settings,
    .app-shell.is-sidebar-compact .nav-user-profile {
        justify-content: center;
        padding-left: 0.56rem;
        padding-right: 0.56rem;
    }

    .app-shell.is-sidebar-compact .app-sidebar-foot {
        padding-left: 0.56rem;
        padding-right: 0.56rem;
        gap: 0;
        align-items: center;
    }

    .app-shell.is-sidebar-compact .nav-user {
        flex-direction: column;
        align-items: center;
        gap: 0;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .nav-user-logout-form {
        justify-content: center;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .app-sidebar-foot-row {
        flex-direction: column;
        align-items: center;
        gap: 0;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .nav-user-profile {
        flex: 0 0 auto;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .app-sidebar-settings {
        flex: 0 0 auto;
        width: 100%;
    }

    .app-shell.is-sidebar-compact .nav-user-logout,
    .app-shell.is-sidebar-compact .app-sidebar-help {
        padding: 0.88rem 0.56rem;
    }
}

.help-page {
    max-width: 67.2rem;
}

.help-lead {
    font-size: 1.68rem;
    margin-bottom: 2.4rem;
}

.help-section {
    margin-bottom: 1.6rem;
}

.help-section h2 {
    margin-top: 0;
}

.help-section ul {
    margin: 0.8rem 0 0;
    padding-left: 2rem;
}

.help-section li + li {
    margin-top: 0.56rem;
}

.help-section h3 {
    margin: 2rem 0 0.8rem;
    font-size: 1.6rem;
}

.help-markup-source {
    margin: 0.8rem 0 0;
    padding: 1.2rem 1.6rem;
    background: #f4f4f5;
    border-radius: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.44rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-x: auto;
}

.help-markup-preview {
    margin-top: 0.8rem;
    padding: 1.2rem 1.6rem;
    border: 1px solid #e4e4e7;
    border-radius: 0.8rem;
}

.note-markup-help-link {
    margin-left: 0.56rem;
}
@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        flex: none;
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.56rem 1.2rem;
        padding: 1.2rem 1.6rem;
    }

    .brand {
        padding: 0;
        margin-right: 0.4rem;
    }

    .app-nav {
        margin-top: 0;
        padding: 0;
        border-top: none;
    }

    .app-nav > ul {
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.24rem;
    }

    .app-nav-link {
        padding: 0.56rem;
        font-size: 1.408rem;
        border-left-width: 8px;
        border-left-style: solid;
        border-left-color: transparent;
    }

    .nav-user-profile,
    .app-sidebar-settings {
        border-left-width: 8px;
        border-left-style: solid;
        border-left-color: transparent;
    }

    .app-nav-link.is-active,
    .nav-user-profile.is-active,
    .app-sidebar-settings.is-active {
        border-left-color: transparent;
        background: var(--color-highlight);
        color: #000;
        color: var(--color-highlight-text);
        border-radius: 4px;
    }

    .app-nav-link.is-active:hover,
    .app-nav-link.is-active:focus-visible,
    .nav-user-profile.is-active:hover,
    .nav-user-profile.is-active:focus-visible,
    .app-sidebar-settings.is-active:hover,
    .app-sidebar-settings.is-active:focus-visible {
        background: var(--color-highlight);
        color: var(--color-highlight-text);
    }

    .app-nav li.add-divider {
        flex-basis: 100%;
    }

    .app-nav li.add-divider::after {
        margin: 0.24rem 0;
    }

    .app-nav-divider {
        flex-basis: 100%;
        margin: 0.24rem 0;
    }

    .app-nav-label,
    .app-sidebar-settings-label,
    .nav-user-name {
        display: none;
    }

    .app-sidebar-foot {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.8rem 1.2rem;
        border-top: none;
        padding: 0;
        margin-top: 0;
        margin-left: auto;
    }

    .app-sidebar-settings {
        flex: 0 0 auto;
        padding: 0.56rem;
    }

    .app-sidebar-foot-row {
        flex: 0 0 auto;
    }

    .app-sidebar-help {
        padding: 0.56rem;
    }

    .nav-user {
        min-width: 0;
    }

    .nav-user-profile {
        padding: 0.4rem;
        gap: 0;
    }

    .app-content {
        padding: 2rem 1.6rem 4rem;
    }
}
