/* Shared shell for the main site's glass-card pages. */
*, *::before, *::after { box-sizing: border-box; }

html { width: 100%; height: auto; min-height: 100%; overflow-x: hidden; }
body {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    overflow: visible;
    isolation: isolate;
}

/* Clip the moving decoration inside its own viewport-sized layer. Without
   this layer, transformed pseudo-elements enlarge the mobile viewport. */
.site-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}
.site-background::before, .site-background::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: site-background-move 25s infinite alternate ease-in-out;
}
.site-background::before {
    width: 400px; height: 400px;
    top: -10%; left: -10%;
    background: var(--background-gradient-1);
}
.site-background::after {
    width: 500px; height: 500px;
    bottom: -15%; right: -15%;
    background: var(--background-gradient-2);
    animation-delay: -12s;
}
@keyframes site-background-move {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(80px, -120px) scale(1.4); }
    100% { transform: translate(-40px, 60px) scale(1); }
}

body > .container {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(96px + env(safe-area-inset-top, 0px))
        max(20px, env(safe-area-inset-right, 0px))
        max(24px, env(safe-area-inset-bottom, 0px))
        max(20px, env(safe-area-inset-left, 0px));
}
.content-card, .login-card { min-width: 0; overflow-wrap: anywhere; }
.content-card { width: 100%; }
.dashboard-grid > *, .chart-container { min-width: 0; }
.cta-button > img, .cta-button > svg { flex-shrink: 0; }
.cta-button > span { min-width: 0; }
#qr-code { max-width: 100%; }
.form-control { min-width: 0; font-size: 16px; }

body > .theme-switcher {
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
}
body > .user-menu {
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: max(20px, env(safe-area-inset-left, 0px));
    max-width: calc(100% - 100px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    flex-wrap: nowrap;
}
.user-menu .username {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user-menu a { flex-shrink: 0; }

@media (max-width: 840px) {
    body > .container { align-items: flex-start; }
    .content-card, .login-card { padding: 28px 20px; }
}
@media (max-width: 640px) {
    body > .container { padding-left: 16px; padding-right: 16px; }
    .user-menu .username { display: none; }
    .user-menu a { padding-left: 10px; padding-right: 10px; }
    .content-card { border-radius: 20px; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .site-background::before, .site-background::after { animation: none; }
}
