.app-shell {
    width: min(100%, var(--ui-page-max));
    margin: 0 auto;
    padding: 0 var(--ui-page-gutter) 36px;
}

.page {
    min-width: 0;
}

.page-narrow {
    width: min(100%, var(--ui-reading-max));
    margin: 0 auto;
    padding-top: 24px;
}

.card {
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-md);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-xs);
}

.grid-2,
.grid-3,
.admin-grid {
    display: grid;
    gap: 12px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
}

.section-head h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.section-head p {
    margin: 5px 0 0;
    font-size: 13px;
}

.page-top {
    position: sticky;
    top: 0;
    z-index: var(--ui-z-sticky);
    min-height: 58px;
    margin-top: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--ui-nav-surface);
}

.brand-lockup {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup.compact {
    min-height: var(--ui-touch-target);
    gap: 10px;
    font-weight: 800;
}

.brand-lockup.compact strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--ui-radius-md);
    background: var(--ui-primary);
    color: var(--ui-on-primary);
    font-size: 20px;
    font-weight: 900;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
    opacity: 0;
    transition: opacity var(--ui-duration-fast) ease-out;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo img.loaded,
.brand-logo.has-logo img {
    opacity: 1;
}

.brand-logo.has-logo span {
    display: none;
}

body:has(.desktop-nav:not(:empty)) .page-top,
.desktop-nav:not(:empty) + .app-shell .page-top {
    display: none;
}

.site-footer {
    padding-top: 0;
}

.footer-card {
    margin-top: 34px;
    padding: 20px 14px;
    border-width: 1px 0 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.8;
    text-align: center;
}

.footer-card a:hover {
    color: var(--ui-primary);
}

.footer-split {
    margin: 0 6px;
    color: var(--ui-line-strong);
}

.back-to-top {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: 24px;
    z-index: var(--ui-z-sticky);
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--ui-radius-md);
    background: var(--ui-primary);
    color: var(--ui-on-primary);
    box-shadow: var(--ui-shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity var(--ui-duration-fast) ease-out, transform var(--ui-duration-fast) ease-out;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top span {
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}
