:root {
    --color-primary: #5ba5ff;
    --color-primary-dark: #3a7bff;
    --color-background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #0b1627 100%);
    --color-surface: rgba(15, 23, 42, 0.78);
    --color-surface-solid: #16213d;
    --color-border: rgba(148, 163, 184, 0.25);
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --color-success: #34d399;
    --shadow-elevated: 0 30px 80px rgba(8, 15, 34, 0.45);
    --radius-large: 24px;
    --radius-medium: 16px;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

a:hover,
a:focus {
    color: var(--color-primary);
    text-decoration: none;
}

.app-body {
    background: var(--color-background);
    min-height: 100vh;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 16px 32px;
}

@media (min-width: 768px) {
    .page-shell {
        padding: 48px 56px 64px;
    }
}

.site-header {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
    padding: 20px 22px;
    border-radius: var(--radius-medium);
    background: linear-gradient(120deg, rgba(21, 35, 62, 0.9), rgba(11, 22, 39, 0.92));
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 60px rgba(7, 12, 24, 0.35);
}

@media (min-width: 768px) {
    .site-header {
        width: 90%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 20px 28px;
    }
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    color: inherit;
    text-decoration: none;
}

@media (max-width: 767px) {
    .brand {
        justify-content: center;
    }
}

.brand-logo {
    width: 52px;
    height: 52px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
    flex-wrap: nowrap;
}

@media (min-width: 768px) {
    .header-actions {
        gap: 16px;
        width: auto;
    }
}

.header-link {
    color: var(--color-muted);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.35);
    white-space: nowrap;
}

.header-link:hover,
.header-link:focus {
    color: var(--color-primary);
    border-color: rgba(91, 165, 255, 0.6);
    transform: translateY(-1px);
}

.user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--color-text);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(7, 12, 24, 0.28);
}

.user-badge:focus {
    outline: none;
    border-color: rgba(91, 165, 255, 0.6);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(91, 165, 255, 0.25);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--color-primary);
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu .dropdown-menu {
    min-width: 180px;
    padding: 12px;
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(7, 12, 24, 0.45);
}

.user-menu .dropdown-item {
    border-radius: 8px;
    font-weight: 600;
    color: var(--color-text);
}

.user-menu .dropdown-item:hover,
.user-menu .dropdown-item:focus {
    background: rgba(91, 165, 255, 0.12);
    color: var(--color-primary);
}

.main-content {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.site-footer {
    width: min(1120px, 100%);
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
}

.content-card {
    width: min(960px, 100%);
    background: var(--color-surface);
    border-radius: var(--radius-large);
    padding: clamp(32px, 5vw, 56px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-elevated);
    backdrop-filter: blur(14px);
}

@media (max-width: 575px) {
    .content-card {
        padding: 28px 20px;
    }
}

.content-card h1 {
    font-weight: 700;
    margin-bottom: 12px;
}

.content-card p {
    color: var(--color-muted);
}

.welcome-page {
    width: 90%;
    display: grid;
    gap: 28px;
}

@media (max-width: 575px) {
    .welcome-page {
        width: 100%;
        gap: 22px;
    }
}

.welcome-page .hero {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.welcome-page .hero-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 700;
}

.welcome-page .hero-title img {
    width: clamp(60px, 8vw, 88px);
}

.welcome-page .hero-subtitle {
    color: var(--color-muted);
    font-size: 1rem;
    max-width: 52ch;
}

.welcome-page .cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.btn-primary-glow,
.btn-outline-light {
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-glow {
    background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
    border: 0;
    color: #0b1120;
    box-shadow: 0 12px 30px rgba(91, 165, 255, 0.35);
}

.btn-primary-glow:hover,
.btn-primary-glow:focus {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(91, 165, 255, 0.45);
    color: #020617;
}

.btn-outline-light {
    border: 1px solid rgba(226, 232, 240, 0.4);
    color: var(--color-text);
    background: transparent;
}

.btn-outline-light:hover,
.btn-outline-light:focus {
    border-color: rgba(226, 232, 240, 0.65);
    transform: translateY(-1px);
}

.welcome-highlights {
    display: grid;
    gap: 16px;
}

@media (min-width: 768px) {
    .welcome-highlights {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.highlight-card {
    background: rgba(15, 23, 42, 0.65);
    border-radius: var(--radius-medium);
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.highlight-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.highlight-card p {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0;
}

.version-chip {
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.15);
    color: #bae6fd;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-shell {
    width: min(480px, 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-large);
    padding: clamp(32px, 5vw, 44px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: var(--shadow-elevated);
    backdrop-filter: blur(16px);
}

@media (max-width: 575px) {
    .auth-card {
        padding: 28px 20px;
    }
}

.auth-card .auth-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.auth-card .auth-logo img {
    width: 56px;
}

.auth-card .auth-logo span {
    font-size: 1.8rem;
    font-weight: 700;
}

.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.auth-card p {
    color: var(--color-muted);
    margin-bottom: 24px;
}

.password-help {
    padding-left: 18px;
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.password-help li {
    margin-bottom: 4px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-stack .form-group {
    margin: 0;
}

.form-control,
.form-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    color: var(--color-text);
    padding: 10px 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(91, 165, 255, 0.6);
    box-shadow: 0 0 0 0.2rem rgba(91, 165, 255, 0.25);
    background: rgba(15, 23, 42, 0.75);
    color: var(--color-text);
}

label {
    font-weight: 500;
    color: rgba(226, 232, 240, 0.85);
    margin-bottom: 6px;
}

.pw-inline {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.pw-inline .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.pw-btn {
    white-space: nowrap;
    border-radius: 12px;
    padding: 10px 16px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.6);
    color: var(--color-muted);
}

.pw-btn:hover,
.pw-btn:focus {
    border-color: rgba(91, 165, 255, 0.6);
    color: var(--color-text);
    box-shadow: 0 0 0 0.2rem rgba(91, 165, 255, 0.2);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 575px) {
    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-footer .btn {
    flex: 1 1 auto;
    min-width: 120px;
    border-radius: 12px;
    font-weight: 600;
}

.form-footer .btn-secondary {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--color-text);
}

.form-footer .btn-secondary:hover,
.form-footer .btn-secondary:focus {
    border-color: rgba(91, 165, 255, 0.5);
}

.form-footer .btn-primary {
    background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
    border: 0;
    color: #031225;
    box-shadow: 0 12px 30px rgba(91, 165, 255, 0.35);
}

.form-footer .btn-primary:hover,
.form-footer .btn-primary:focus {
    box-shadow: 0 16px 34px rgba(91, 165, 255, 0.45);
}

.aux-links {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--color-muted);
    font-size: 0.95rem;
    margin-top: 12px;
}

.aux-links a {
    color: var(--color-primary);
}

.oauth-block {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    text-align: center;
}

.oauth-block span {
    display: block;
    margin-bottom: 16px;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.oauth-providers {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.oauth-providers a {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, border 0.2s ease;
}

.oauth-providers a:hover,
.oauth-providers a:focus {
    transform: translateY(-2px);
    border-color: rgba(91, 165, 255, 0.6);
}

.status-card {
    width: min(520px, 100%);
    background: var(--color-surface);
    border-radius: var(--radius-large);
    padding: clamp(28px, 5vw, 40px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: var(--shadow-elevated);
    text-align: left;
}

.status-card h1 {
    margin-bottom: 12px;
}

.status-card p {
    color: var(--color-muted);
    margin-bottom: 0;
}

.status-card .btn,
.status-card button {
    border-radius: 12px;
}

.status-card .btn-primary,
.status-card button.btn-primary {
    background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
    border: 0;
    color: #031225;
}

.status-card small {
    color: var(--color-muted);
}

.logged-out-page iframe {
    display: none;
    width: 0;
    height: 0;
}

.grants-page .card {
    margin-top: 20px;
    border-bottom: 1px solid lightgray;
}

    .grants-page .card .card-title {
        font-size: 120%;
        font-weight: bold;
    }

        .grants-page .card .card-title img {
            width: 100px;
            height: 100px;
        }

    .grants-page .card label {
        font-weight: bold;
    }
