html,
body,
#app {
    min-height: 100%;
}

body {
    margin: 0;
    background: #f4f7fb;
    color: #172335;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
}

.app-loading-state {
    min-height: 100vh;
    background: #f4f7fb;
}

.loading-progress {
    position: absolute;
    top: calc(50% - 3rem);
    left: calc(50% - 3rem);
    width: 6rem;
    height: 6rem;
}

.loading-progress circle {
    fill: none;
    stroke: #dbe3ee;
    stroke-width: 0.6rem;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.loading-progress circle:last-child {
    stroke: #76bc21;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
}

.loading-progress-text {
    display: none;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
    background: #fff3cd;
    color: #172335;
    box-shadow: 0 -4px 14px rgba(16, 42, 67, 0.14);
    padding: 10px 40px 10px 16px;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 8px;
    right: 14px;
    cursor: pointer;
}

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: #002d4f;
    color: #fff;
    padding: 22px 18px;
}

.brand {
    display: grid;
    gap: 8px;
    margin-bottom: 26px;
}

.brand img {
    width: 170px;
    height: auto;
}

.slogan {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
}

.sidebar nav {
    display: grid;
    gap: 4px;
}

.sidebar nav a {
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.82);
    padding: 10px 12px;
    text-decoration: none;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(118, 188, 33, 0.18);
    color: #fff;
}

.nav-separator {
    height: 1px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.16);
}

.user-card {
    display: grid;
    gap: 8px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 16px;
    font-size: 0.9rem;
}

.user-card span {
    color: rgba(255, 255, 255, 0.7);
}

.app-content {
    min-width: 0;
    padding: 30px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    color: #002d4f;
    font-size: 1.7rem;
    font-weight: 700;
}

.page-header p {
    max-width: 820px;
    margin: 6px 0 0;
    color: #526274;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.grid-panel,
.content-panel {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(16, 42, 67, 0.06);
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.course-card {
    display: grid;
    overflow: hidden;
    min-height: 330px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
}

.course-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #e8edf5;
}

.course-card-body {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.course-code {
    color: #76bc21;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.course-card h2 {
    margin: 0;
    color: #002d4f;
    font-size: 1.06rem;
}

.course-card p {
    margin: 0;
    color: #526274;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(16, 42, 67, 0.06);
}

.dashboard-hero h1 {
    margin: 4px 0 8px;
    color: #002d4f;
    font-size: 1.85rem;
}

.dashboard-hero p,
.dashboard-panel p {
    margin: 0;
    color: #526274;
}

.dashboard-eyebrow {
    color: #76bc21;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dashboard-progress {
    display: grid;
    place-items: center;
    width: 132px;
    height: 132px;
    justify-self: end;
    border: 8px solid #e4edf6;
    border-radius: 50%;
    color: #002d4f;
}

.dashboard-progress strong {
    font-size: 1.75rem;
    line-height: 1;
}

.dashboard-progress span {
    color: #526274;
    font-size: 0.78rem;
}

.account-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    border: 1px solid #f2c94c;
    border-radius: 8px;
    background: #fff8df;
    padding: 14px 16px;
}

.account-alert div {
    display: grid;
    gap: 2px;
}

.account-alert span {
    color: #526274;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.dashboard-panel {
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(16, 42, 67, 0.06);
}

.stat-card {
    display: grid;
    gap: 8px;
    padding: 16px;
}

.stat-card span {
    color: #526274;
    font-size: 0.86rem;
}

.stat-card strong {
    color: #002d4f;
    font-size: 1.55rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-panel {
    display: grid;
    gap: 14px;
    align-content: start;
    padding: 18px;
}

.dashboard-panel h2 {
    margin: 0;
    color: #002d4f;
    font-size: 1.15rem;
}

.dashboard-next {
    min-height: 260px;
}

.course-progress-line {
    overflow: hidden;
    height: 8px;
    border-radius: 4px;
    background: #e4edf6;
}

.course-progress-line span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #76bc21;
}

.dashboard-next small,
.profile-summary small {
    color: #526274;
}

.quick-actions,
.route-list,
.activity-list {
    display: grid;
    gap: 10px;
}

.route-row,
.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 10px;
}

.route-row:last-child,
.activity-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.route-row strong,
.activity-row strong {
    color: #172335;
}

.route-row span,
.activity-row span {
    color: #526274;
    font-size: 0.85rem;
    text-align: right;
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 620px) minmax(240px, 320px);
    align-items: start;
    gap: 16px;
}

.profile-summary {
    display: grid;
    gap: 10px;
}

.profile-summary strong {
    color: #002d4f;
    font-size: 1.15rem;
}

.profile-summary span {
    color: #526274;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    background: linear-gradient(135deg, #002d4f 0%, #17496d 54%, #76bc21 100%);
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    border-radius: 8px;
    background: #fff;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 45, 79, 0.28);
}

.login-panel img {
    width: 180px;
    margin-bottom: 22px;
}

.login-panel h1 {
    margin: 0 0 18px;
    color: #002d4f;
    font-size: 1.5rem;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.error-text {
    color: #b42318;
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .dashboard-hero,
    .dashboard-grid,
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-progress {
        justify-self: start;
    }

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

    .account-alert,
    .route-row,
    .activity-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .route-row span,
    .activity-row span {
        text-align: left;
    }

    .sidebar {
        position: static;
    }

    .app-content {
        padding: 18px;
    }
}
