/* App shell: left sidebar + top bar. Styles only .app-* elements. */
.app-shell {
    --app-sidebar-bg: #141821;
    --app-sidebar-active: #383E4D;
    --app-sidebar-text: #DADEE5;
    --app-sidebar-muted: #B5BBC5;
    --app-topbar-text: #8C929D;
    --app-muted-bg: #F5F6F8;
    --app-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: stretch;
    min-height: 100vh;
}

/* Fixed to the viewport rather than a sticky panel in a page-height column: nothing on the left scrolls, so
   Chromium has nothing to repaint there and no white flashes on fast scrolls. .app-main is offset to match. */
.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 232px;
    z-index: 30;
    overflow-y: auto;
    background: var(--app-sidebar-bg);
    font-family: var(--app-font);
}

.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    padding: 24px 0 20px;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 28px;
    text-decoration: none;
}

.app-sidebar-brand:hover,
.app-sidebar-brand:focus {
    text-decoration: none;
}

.app-sidebar-logo {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
}

.app-sidebar-wordmark {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.app-sidebar-wordmark small {
    display: block;
    font-weight: 500;
    font-size: 11px;
    color: var(--app-sidebar-muted);
    letter-spacing: .02em;
}

.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 0 4px;
    border-radius: 12px;
    color: var(--app-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.app-sidebar-link i {
    width: 16px;
    flex: 0 0 auto;
    text-align: center;
    font-size: 13.5px;
}

.app-sidebar-link span {
    flex: 1 1 auto;
}

.app-sidebar-link .app-sidebar-link-arrow {
    display: none;
    font-size: 12px;
}

.app-sidebar-link:hover,
.app-sidebar-link:focus {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
    text-decoration: none;
}

.app-sidebar-link-active,
.app-sidebar-link-active:hover,
.app-sidebar-link-active:focus {
    background: var(--app-sidebar-active);
    color: #FFFFFF;
    font-weight: 600;
}

.app-sidebar-link-active .app-sidebar-link-arrow {
    display: inline;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-sidebar ~ .app-main {
    margin-left: 232px;
}

.app-shell-muted .app-main {
    background: var(--app-muted-bg);
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 28px 20px;
    /* Same height with or without the Sites search box (40px), so page content starts at the same place everywhere. */
    box-sizing: border-box;
    min-height: 74px;
    font-family: var(--app-font);
}

.app-menu-toggle {
    display: none;
    border: none;
    background: #F1F2F6;
    color: #141821;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 15px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.app-shell-guest .app-menu-toggle {
    display: none !important;
}

.app-no-scroll {
    overflow: hidden;
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(20, 24, 33, 0.5);
    z-index: 39;
}

/* Sites search, top-left like Autopromotor's: white box with the search icon on the right. */
.app-search {
    position: relative;
    flex: 0 1 360px;
    min-width: 0;
    margin: 0;
}

.app-search-input {
    width: 100%;
    height: 40px;
    padding: 0 42px 0 14px;
    border: 1px solid #DADEE5;
    border-radius: 12px;
    background: #FFFFFF;
    color: #141821;
    font-family: var(--app-font);
    font-size: 13.5px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.app-search-input::placeholder {
    color: #8C929D;
}

.app-search-input:focus {
    border-color: #141821;
    box-shadow: 0 0 0 3px rgba(20, 24, 33, 0.14);
}

/* The button supplies the icon; hide the browser's own clear (x) so the two don't overlap. */
.app-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.app-search-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 42px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #8C929D;
    font-size: 15px;
    cursor: pointer;
    border-radius: 0 12px 12px 0;
}

.app-search-btn:hover, .app-search-btn:focus-visible {
    color: #141821;
    outline: none;
}

.app-logout-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 0 auto;
}

.app-user-name {
    font-size: 13px;
    color: var(--app-topbar-text);
}

.app-main .container {
    width: auto;
    max-width: 100%;
}

/* site.css gives body 20px bottom padding, which shows as a white strip under the shell;
   move that spacing inside the main area instead. */
.app-body {
    padding-bottom: 0;
}

.app-main > .container.body-content {
    width: 100%;
    /* Older pages (e.g. horizontal Bootstrap forms) were built for a fixed-width centred container. */
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 32px 20px;
    /* Fill the remaining height so the footer sits at the bottom of short pages. */
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Redesigned pages (Sites 1.5, login) use the full width next to the sidebar. */
.app-shell-muted .app-main > .container.body-content {
    max-width: none;
    margin: 0;
}

.app-content {
    flex: 1 0 auto;
}

.app-main > .container.body-content > .footer {
    color: #8C929D;
}

@media (max-width: 900px) {
    .app-menu-toggle {
        display: flex;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        width: 264px;
        max-width: 82vw;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 12px 0 32px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
    }

    .app-sidebar ~ .app-main {
        margin-left: 0;
    }

    .app-shell.app-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.app-sidebar-open .app-sidebar-backdrop {
        display: block;
    }

    .app-topbar {
        padding: 10px 16px;
        min-height: 60px;
    }

    .app-search {
        flex: 1 1 auto;
    }

    .app-user-name {
        display: none;
    }

    .app-main > .container.body-content {
        padding: 0 16px 20px;
    }
}

/* ---------- login card (Account pages) ---------- */
.login-page {
    display: flex;
    justify-content: center;
    padding: 64px 0 32px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 36px 32px;
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow: 0 0 2px rgba(20, 24, 33, 0.06), 0 8px 24px rgba(20, 24, 33, 0.08);
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.login-card-mark {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: #141821;
    letter-spacing: -0.01em;
}

.login-card-subtitle {
    margin: 0 0 28px;
    font-size: 14px;
    color: #8C929D;
}

.login-card-providers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.login-card .login-provider-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid #DADEE5;
    border-radius: 12px;
    background: #FFFFFF;
    color: #141821;
    font-size: 15px;
    font-weight: 600;
    transition: border-color .15s ease, background-color .15s ease;
}

.login-card .login-provider-btn:hover,
.login-card .login-provider-btn:focus {
    border-color: #141821;
    background: #F5F6F8;
    outline: none;
}

/* Message pages (access denied, lockout, login failure) reuse the login card. */
.login-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    border-radius: 50%;
    background: #FFF0F0;
    color: #D94343;
    font-size: 22px;
}

.login-card a.login-provider-btn {
    text-decoration: none;
}
