/*
 * Layout
 * 의뢰인 사이트의 앱 쉘, 상단/하단 네비게이션, 본문/푸터 레이아웃.
 */
body:not(.public-site) .portal {
    height: 100dvh;
    min-height: 100vh;
    width: min(100%, var(--app-shell-max-width));
    margin: 0 auto;
    background: var(--color-bg-page);
    box-shadow: var(--shadow-shell);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body:not(.public-site) .app-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
    background: var(--color-bg-page);
}

.sidebar {
    display: none;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    padding: 22px 18px;
    background: #111827;
    color: #fff;
}

.sidebar .brand-mark {
    margin-bottom: 26px;
}

.tenant,
.assist-box {
    padding: 14px;
    border-radius: 8px;
}

.tenant {
    border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(255, 255, 255, .06);
    margin-bottom: 18px;
}

.tenant b,
.assist-box b {
    display: block;
    margin-bottom: 5px;
    font-size: var(--font-size-body);
}

.tenant span {
    color: rgba(255, 255, 255, .68);
    font-size: var(--font-size-caption);
}

.nav,
.sidebar-bottom,
.menu-list,
.alert-list,
.document-list,
.info-list,
.chat-thread {
    display: grid;
}

.nav {
    gap: 6px;
}

.nav button {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, .68);
    padding: 12px;
    text-align: left;
    font-weight: 700;
}

.nav button.active,
.nav button:hover {
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.nav-ico {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .10);
    font-size: var(--font-size-caption);
}

.sidebar-bottom {
    margin-top: auto;
    gap: 12px;
}

.assist-box {
    background: #fff;
    color: var(--ink);
}

.assist-box span {
    display: block;
    color: var(--muted);
    font-size: var(--font-size-caption);
    line-height: 1.5;
}

body:not(.public-site) .content {
    min-width: 0;
    flex: 1;
    padding: 18px 18px 116px;
}

body:not(.public-site) .topbar {
    /* position: fixed;
    top: 0;
    left: 50%;
    z-index: 20; */
    display: flex;
    align-items: center;
    width: min(100%, var(--app-shell-max-width));
    min-height: 52px;
    padding: 8px 18px;
    background: rgba(247, 248, 251, .92);
    border-bottom: 1px solid rgba(216, 222, 232, .8);
    /* transform: translateX(-50%); */
    backdrop-filter: blur(14px);
}

.firm-title b {
    display: block;
    overflow: hidden;
    font-size: var(--font-size-body);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

body:not(.public-site) .mobile-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: space-around;
    width: min(100%, var(--app-shell-max-width));
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    /* 모바일 브라우저에서 기기 안전 영역(safe area) 값 */
    border-top: 1px solid rgba(216, 222, 232, .9);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, .08);
    transform: translateX(-50%);
    backdrop-filter: blur(12px);
}

body:not(.public-site) .mobile-nav button,
body:not(.public-site) .mobile-nav a {
    display: grid;
    place-items: center;
    gap: 4px;
    min-width: 62px;
    min-height: 50px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7c8798;
    font-size: var(--font-size-meta);
    font-weight: 500;
    margin-left: 0;
    text-decoration: none;
}

body:not(.public-site) .mobile-nav .nav-icon {
    font-size: var(--font-size-card-title);
    line-height: 1;
}

body:not(.public-site) .mobile-nav button.active,
body:not(.public-site) .mobile-nav a.active {
    background: #eef2f7;
    color: #182230;
}

body:not(.public-site) .app-footer {
    padding: 0 18px 94px;
    color: var(--muted);
    font-size: var(--font-size-meta);
    line-height: 1.55;
}

body:not(.public-site) .app-footer-inner {
    padding: 16px 0 0;
    border-top: 1px solid #d8dee8;
}

body:not(.public-site) .app-footer b {
    color: var(--ink);
}

@media (max-width: 520px) {
    body:not(.public-site) .portal {
        box-shadow: none;
    }
}
