:root {
    --sidebar-width: 18rem;
    --sidebar-bg: rgba(24, 24, 24, 0.92);
    --sidebar-border: rgba(255, 255, 255, 0.14);
    --button-bg: rgba(255, 255, 255, 0.08);
    --button-hover: rgba(255, 255, 255, 0.16);
    --button-active: #c41230;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.72);
    --mobile-bar-bg: rgba(24, 24, 24, 0.88);
}

* {
    box-sizing: border-box;
}

body {
    background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url(../images/fanshawe_wallpaper.jpg);
    background-size: cover;
    font-family: Arial, sans-serif;
    margin: 0;
    animation: grow 1s;
    background-position: center center;
    min-height: 100vh;
    color: var(--text-main);
}

@keyframes grow {
    0% {
        background-size: 70% auto;
    }
    100% {
        background-size: 100% auto;
    }
}

.app-shell {
    display: flex;
    min-height: 100vh;
    backdrop-filter: blur(2px);
    position: relative;
}

.app-shell:not(.app-open) .sidebar {
    display: none;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.22);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 0.75rem;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12));
    border-radius: 999px;
    border: 0.18rem solid transparent;
    background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18));
    border-radius: 999px;
    border: 0.18rem solid transparent;
    background-clip: padding-box;
}

.sidebar-close {
    display: none;
    align-self: flex-end;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.brand {
    padding: 0.25rem 0.5rem 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand .side-menu-reload {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    cursor: pointer;
}

.brand-logo {
    width: 3.1rem;
    height: 3.1rem;
    flex: 0 0 auto;
}

.brand-text {
    min-width: 0;
}

.brand-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
}

.brand-title-main {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 1.3rem;
    font-weight: 600;
    width: 100%;
    line-height: 1em;
}

.brand-title-sub {
    display: block;
    line-height: 1em;
}

.brand-subtitle {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    padding-right: 0.3rem;
}

.app-button {
    width: 100%;
    border: none;
    border-radius: 0.85rem;
    background: var(--button-bg);
    color: var(--text-main);
    text-align: left;
    padding: 0.85rem 0.95rem;
    font-size: 0.97rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.app-button:hover,
.app-button:focus-visible {
    background: var(--button-hover);
    transform: translateX(3px);
    outline: none;
}

.app-button.active {
    background: var(--button-active);
    box-shadow: 0 10px 24px rgba(196, 18, 48, 0.28);
}

.content-panel {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    position: relative;
}

#main-frame {
    width: 100%;
    height: calc(100vh - 2rem);
    display: block;
    overflow: hidden;
    border: none;
    border-radius: 1.1rem;
    background: transparent;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.18);
}

.app-shell:not(.app-open) #main-frame {
    display: none;
}

.mobile-topbar {
    display: none;
}

.menu-toggle {
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    font-size: 0.95rem;
    cursor: pointer;
}

.mobile-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.mobile-title-button {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mobile-logo {
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
}

.home-view {
    width: 100%;
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.app-shell.app-open .home-view {
    display: none;
}

.home-card {
    width: min(64rem, 100%);
    text-align: center;
    padding: 2rem 1.5rem;
}

.home-logo-button {
    display: inline-block;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.home-logo {
    width: 8rem;
    max-width: 32vw;
    display: block;
    margin: 0 auto 1.25rem;
    border-radius: 1rem;
    filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.35));
}

.home-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
}

.home-subtitle {
    margin: 0.75rem auto 2rem;
    max-width: 40rem;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.9rem;
}

.home-app-button {
    border: none;
    border-radius: 1rem;
    background: rgba(24, 24, 24, 0.84);
    color: var(--text-main);
    text-align: center;
    padding: 1rem 1.05rem;
    font-size: 0.98rem;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.home-app-button:hover,
.home-app-button:focus-visible {
    background: rgba(24, 24, 24, 0.94);
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.25);
    outline: none;
}

.home-app-button.active {
    background: var(--button-active);
}

@media (max-width: 900px) {
    body {
        background-attachment: fixed;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(82vw, 20rem);
        height: 100vh;
        border-right: 1px solid var(--sidebar-border);
        border-bottom: none;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-nav {
        max-height: none;
    }

    .content-panel {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        background: var(--mobile-bar-bg);
        border: 1px solid var(--sidebar-border);
        border-radius: 1rem;
        padding: 0.85rem 1rem;
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
    }

    .app-shell:not(.app-open) .mobile-topbar {
        display: none;
    }

    .app-shell.sidebar-open .content-panel::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.28);
        z-index: 10;
    }

    #main-frame {
        height: calc(100vh - 5.75rem);
        min-height: 0;
        border-radius: 1rem;
    }

    .home-card {
        padding: 1rem 0.25rem 2rem;
    }

    .home-title {
        font-size: 1.6rem;
    }

    .home-subtitle {
        margin-bottom: 1.35rem;
        font-size: 0.95rem;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .sidebar {
        width: 88vw;
    }

    .home-view {
        padding: 1rem 0.75rem 1.5rem;
    }

    .home-logo {
        width: 6.5rem;
    }

    .home-title {
        font-size: 1.35rem;
    }

    .home-app-button,
    .app-button {
        font-size: 0.95rem;
    }
}
