* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2937;
    background: linear-gradient(180deg, #8fd3ff 0%, #b8e4ff 45%, #d9f0ff 100%);
    overflow-x: hidden;
}

.page-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vw, 20px);
}

.page-container {
    width: min(100%, 920px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 14px);
}

.main-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(12px, 2vw, 16px);
    align-items: stretch;
    width: 100%;
}

.welcome-panel,
.auth-panel {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 14px;
    padding: clamp(16px, 2.2vw, 22px);
    box-shadow: 0 8px 24px rgba(0, 80, 140, 0.1);
    min-width: 0;
}

.welcome-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.school-logo {
    width: clamp(88px, 11vw, 112px);
    height: clamp(88px, 11vw, 112px);
    object-fit: contain;
    display: block;
    margin: 0 auto clamp(10px, 1.5vw, 12px);
}

.welcome-title {
    margin: 0 0 clamp(8px, 1.2vw, 10px);
    font-size: clamp(1.2rem, 1.8vw, 1.55rem);
    line-height: 1.2;
    color: #0b4f86;
    font-weight: 700;
    text-align: center;
}

.brand-name {
    display: block;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    letter-spacing: 0.4px;
    margin-top: 0.12em;
}

.welcome-text {
    margin: 0 auto;
    max-width: 28rem;
    color: #2563eb;
    font-size: clamp(0.85rem, 1.15vw, 0.92rem);
    line-height: 1.5;
    text-align: center;
}

.powered-by {
    margin-top: clamp(14px, 2.5vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    color: #334155;
    font-size: clamp(0.78rem, 1vw, 0.85rem);
}

.tech-support-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #cbd5e1;
}

.tech-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    flex-shrink: 0;
}

.version {
    font-weight: 700;
}

.auth-panel {
    position: relative;
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.close-btn {
    position: absolute;
    top: clamp(10px, 1.5vw, 16px);
    right: clamp(10px, 1.5vw, 16px);
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
}

.auth-heading {
    margin: clamp(2px, 0.8vw, 4px) 0 clamp(10px, 1.5vw, 12px);
    padding: 0 2rem;
    text-align: center;
    font-size: clamp(0.92rem, 1.4vw, 1.05rem);
    letter-spacing: 0.4px;
}

.user-icon-wrap {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.2vw, 10px);
    margin: 0 auto clamp(12px, 1.8vw, 16px);
    width: min(100%, 300px);
}

.user-icon-bar {
    flex: 1;
    height: clamp(5px, 0.7vw, 6px);
    background: #111;
    border-radius: 999px;
}

.user-icon-circle {
    width: clamp(46px, 6.5vw, 56px);
    height: clamp(46px, 6.5vw, 56px);
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-icon-circle svg {
    width: clamp(24px, 3.2vw, 30px);
    height: clamp(24px, 3.2vw, 30px);
    fill: #fff;
}

.alert {
    max-width: 340px;
    margin: 0 auto 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    text-align: center;
    font-weight: 600;
}

.inline-logout-form {
    margin: 0;
}

.inline-logout-btn {
    border: 1px solid #16a34a;
    background: #fff;
    color: #15803d;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.auth-session-panel {
    width: min(100%, 340px);
    margin: 0 auto;
    display: grid;
    gap: 14px;
}

.auth-session-user {
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 12px;
}

.auth-impersonation-banner {
    display: grid;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    text-align: center;
}

.auth-impersonation-banner p {
    margin: 0;
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.35;
}

.return-admin-btn {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    background: #1d4f91;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.return-admin-btn:hover {
    background: #163d72;
}

.auth-session-role {
    display: block;
    margin-top: 2px;
    font-size: 0.82rem;
    color: #15803d;
}

.auth-session-details {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #fff;
}

.auth-session-row {
    display: grid;
    gap: 4px;
}

.auth-session-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.auth-session-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
}

.auth-session-logout-form {
    margin: 0;
}

.logout-session-btn {
    width: 100%;
    border: 2px solid #2563eb;
    background: #fff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.logout-session-btn:hover {
    background: #eff6ff;
}

.login-form {
    width: min(100%, 340px);
    margin: 0 auto;
    display: grid;
    gap: clamp(6px, 1vw, 8px);
}

.login-form label {
    font-size: clamp(0.82rem, 1vw, 0.88rem);
    font-weight: 600;
    color: #111827;
}

.login-form label[for="username"],
.login-form label[for="password"] {
    text-align: center;
    font-size: clamp(0.95rem, 1.15vw, 1.02rem);
    font-weight: 700;
    color: #0b4f86;
}

.login-form input,
.login-form select {
    width: 100%;
    padding: clamp(8px, 1.1vw, 9px) clamp(10px, 1.3vw, 12px);
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    font-size: clamp(0.88rem, 1.05vw, 0.92rem);
    outline: none;
}

.login-form #username,
.login-form #password {
    text-align: center;
    font-size: clamp(1rem, 1.25vw, 1.08rem);
    font-weight: 700;
    color: #111827;
    padding: clamp(10px, 1.2vw, 11px) clamp(12px, 1.4vw, 14px);
}

.login-form input:focus,
.login-form select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-btn {
    margin-top: clamp(4px, 0.8vw, 6px);
    width: 100%;
    border: 2px solid #2563eb;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    padding: clamp(8px, 1.1vw, 10px) clamp(12px, 1.6vw, 14px);
    font-size: clamp(0.88rem, 1.1vw, 0.92rem);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    background: #eff6ff;
}

.login-btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-btn-icon svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.access-module {
    width: 100%;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 80, 140, 0.1);
}

.access-module-header {
    background: #111;
    color: #fff;
    text-align: center;
    padding: clamp(8px, 1.2vw, 10px) 14px;
    font-size: clamp(0.88rem, 1.3vw, 0.98rem);
    font-weight: 700;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(8px, 1.2vw, 10px);
    padding: clamp(10px, 1.5vw, 14px);
    background: #eef2f7;
}

.module-item {
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    min-height: clamp(64px, 8vw, 76px);
    padding: clamp(8px, 1.2vw, 10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 0.8vw, 6px);
    text-align: center;
    font-size: clamp(0.72rem, 0.95vw, 0.82rem);
    font-weight: 600;
    font-family: inherit;
    width: 100%;
    cursor: default;
}

a.module-item {
    text-decoration: none;
    color: inherit;
}

.module-item.is-enabled {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.module-item.is-enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15);
    background: #fff;
}

.module-item.is-disabled,
.module-item:disabled {
    opacity: 0.45;
    filter: grayscale(0.35);
    cursor: not-allowed;
    pointer-events: none;
}

.module-item-wide {
    grid-column: span 2;
    flex-direction: row;
    justify-content: center;
}

.module-icon {
    width: clamp(30px, 3.8vw, 34px);
    height: clamp(30px, 3.8vw, 34px);
    border-radius: 8px;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.module-icon-green {
    background: #dcfce7;
    color: #15803d;
}

.module-icon-lock {
    background: #fef3c7;
    color: #b45309;
}

.dashboard-body {
    background: linear-gradient(180deg, #8fd3ff 0%, #d9f0ff 100%);
}

.dashboard-shell {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 32px) clamp(16px, 2.5vw, 20px);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: clamp(16px, 2.5vw, 20px) clamp(18px, 2.5vw, 24px);
    box-shadow: 0 8px 24px rgba(0, 80, 140, 0.12);
}

.dashboard-header h1 {
    margin: 0 0 6px;
    color: #0b4f86;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.dashboard-header p {
    margin: 0;
    color: #475569;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
}

.logout-btn {
    border: 2px solid #2563eb;
    background: #fff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: clamp(18px, 2.5vw, 24px);
    box-shadow: 0 8px 24px rgba(0, 80, 140, 0.12);
}

.dashboard-card h2 {
    margin-top: 0;
    color: #0b4f86;
}

.session-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.session-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-note {
    margin: 0;
    color: #64748b;
}

/* Large desktops — keep content centered, avoid over-stretching */
@media (min-width: 1400px) {
    .page-container {
        width: min(100%, 960px);
    }
}

/* Laptops and small desktops */
@media (max-width: 1024px) {
    .main-card {
        grid-template-columns: 1fr;
    }

    .welcome-panel,
    .auth-panel {
        width: 100%;
    }

    .module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .module-item-wide {
        grid-column: span 3;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .page-shell {
        align-items: flex-start;
        padding-top: 16px;
        padding-bottom: 16px;
    }

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

    .module-item-wide {
        grid-column: span 2;
    }

    .auth-heading {
        padding: 0 3rem 0 1rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .page-shell {
        padding: 10px;
    }

    .welcome-panel,
    .auth-panel {
        padding: 18px 16px;
        border-radius: 14px;
    }

    .access-module {
        border-radius: 14px;
    }

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

    .module-item-wide {
        grid-column: span 1;
    }

    .close-btn {
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Short viewports (small laptop height) — allow scroll instead of clipping */
@media (max-height: 720px) {
    .page-shell {
        align-items: flex-start;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Change Account Password modal */
.change-password-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 35, 71, 0.48);
}

.change-password-overlay.hidden {
    display: none;
}

.change-password-modal {
    position: relative;
    width: min(100%, 440px);
    padding: 22px 22px 20px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 35, 71, 0.28);
}

.change-password-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.change-password-close:hover {
    color: #0f2347;
}

.change-password-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 24px;
}

.change-password-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
}

.change-password-header h2 {
    margin: 0 0 4px;
    color: #0b4f86;
    font-size: 1.2rem;
}

.change-password-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
}

.change-password-alert {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.change-password-alert.hidden {
    display: none;
}

.change-password-alert-error {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.change-password-alert-success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.change-password-form {
    display: grid;
    gap: 12px;
}

.change-password-field {
    display: grid;
    gap: 6px;
}

.change-password-field span {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 600;
}

.change-password-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #fff;
}

.change-password-field input[readonly] {
    background: #f8fafc;
    color: #475569;
}

.change-password-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.change-password-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.change-password-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.change-password-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.change-password-btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.change-password-btn-secondary:hover {
    background: #cbd5e1;
}

.change-password-btn-primary {
    background: linear-gradient(135deg, #0b4f86 0%, #1d4ed8 100%);
    color: #fff;
}

.change-password-btn-primary:hover {
    filter: brightness(1.05);
}
