:root {
    --login-teal: #88D0C5;
    --login-teal-dark: #5eb8aa;
    --login-green: #8BC740;
    --login-bg: #F5F5FD;
    --login-soft: #eef9f7;
    --login-white: #ffffff;
    --login-border: #e9ecef;
    --login-text: #111111;
    --login-muted: #6c757d;
    --login-shadow: 0 16px 45px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

body.role-login-body {
    margin: 0;
    min-height: 100vh;
    font-family: Poppins, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(136, 208, 197, 0.35), transparent 34%),
        var(--login-bg);
    color: var(--login-text);
}

.login-shell,
.role-select-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: min(1040px, 100%);
    min-height: 620px;
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    overflow: hidden;
    background: var(--login-white);
    border: 1px solid rgba(233, 236, 239, 0.9);
    border-radius: 18px;
    box-shadow: var(--login-shadow);
}

.login-visual {
    position: relative;
    padding: 44px 42px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 28%, rgba(139, 199, 64, 0.28), transparent 12%),
        radial-gradient(circle at 70% 56%, rgba(255, 255, 255, 0.18), transparent 16%),
        linear-gradient(145deg, var(--login-teal), #6fc5b8);
    color: var(--login-white);
}

.login-visual::before,
.login-visual::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.34);
    width: 74px;
    height: 74px;
    transform: rotate(30deg);
    border-radius: 18px;
}

.login-visual::before {
    right: 52px;
    top: 150px;
}

.login-visual::after {
    right: 86px;
    bottom: 112px;
}

.login-home {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--login-teal-dark);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.login-visual h1 {
    margin: 0 0 22px;
    position: relative;
    z-index: 2;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: 0;
}

.portal-badge {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--login-white);
    font-size: 14px;
    font-weight: 500;
}

.portal-illustration {
    min-height: 310px;
    position: relative;
    z-index: 2;
}

.illustration-person {
    position: absolute;
    left: 22px;
    bottom: 0;
    width: 118px;
    height: 188px;
    border-radius: 70px 70px 26px 26px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
}

.illustration-window {
    position: absolute;
    right: 8px;
    bottom: 58px;
    width: 255px;
    height: 178px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.68);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.14);
    padding: 28px 24px;
}

.illustration-window span {
    display: block;
    height: 12px;
    width: 72%;
    margin-bottom: 14px;
    border-radius: 999px;
    background: rgba(136, 208, 197, 0.42);
}

.illustration-window span:nth-child(2) {
    width: 52%;
}

.illustration-window span:nth-child(3) {
    width: 84%;
}

.illustration-window div {
    width: 84px;
    height: 48px;
    margin-left: auto;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--login-teal), var(--login-green));
    opacity: 0.82;
}

.portal-teacher .illustration-person,
.portal-teacher .illustration-window div {
    background: rgba(139, 199, 64, 0.32);
}

.portal-student .illustration-person {
    border-radius: 30px 30px 70px 70px;
}

.portal-parent .illustration-person {
    width: 145px;
}

.login-form-panel {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 46px;
    background: var(--login-white);
}

.role-login-form {
    width: min(410px, 100%);
}

.role-login-form h2 {
    margin: 0 0 10px;
    color: var(--login-teal-dark);
    font-size: 30px;
    line-height: 1.1;
    font-weight: 600;
    text-align: center;
}

.role-login-form p {
    margin: 0 0 26px;
    color: var(--login-muted);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}

.role-login-form label:not(.remember-row) {
    display: block;
    margin: 16px 0 8px;
    color: var(--login-text);
    font-size: 13px;
    font-weight: 500;
}

.login-input {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #dfe4ea;
    border-radius: 7px;
    background: #fff;
    min-height: 48px;
}

.login-input:focus-within {
    border-color: var(--login-teal);
    box-shadow: 0 0 0 4px rgba(136, 208, 197, 0.18);
}

.login-input > i {
    width: 42px;
    color: var(--login-muted);
    text-align: center;
    font-size: 14px;
}

.login-input input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0 12px 0 0;
    font: inherit;
    color: var(--login-text);
    background: transparent;
}

.login-input input::placeholder {
    color: #a1a8b1;
}

.password-toggle {
    width: 42px;
    border: 0;
    background: transparent;
    color: var(--login-muted);
    cursor: pointer;
}

.forgot-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--login-teal-dark);
    font-size: 13px;
    font-weight: 500;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
    color: var(--login-text);
    font-size: 14px;
    font-weight: 400;
}

.remember-row input {
    width: 14px;
    height: 14px;
    accent-color: var(--login-teal);
}

.login-submit {
    width: 155px;
    height: 48px;
    display: block;
    margin: 26px auto 22px;
    border: 1px solid var(--login-teal-dark);
    border-radius: 999px;
    background: var(--login-white);
    color: var(--login-teal-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.login-submit:hover {
    background: var(--login-teal);
    color: var(--login-text);
    transform: translateY(-1px);
}

.contact-admin {
    text-align: center;
    color: var(--login-text);
    font-size: 14px;
    font-weight: 400;
}

.contact-admin span {
    color: var(--login-teal-dark);
    font-weight: 500;
}

.login-messages {
    margin-bottom: 16px;
}

.login-message {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    border: 1px solid var(--login-border);
    background: var(--login-soft);
}

.login-message-error,
.login-message-danger {
    color: #9f2f24;
    border-color: #ffcbc4;
    background: #ffedea;
}

.role-select-card {
    width: min(850px, 100%);
    padding: 42px;
    background: var(--login-white);
    border: 1px solid var(--login-border);
    border-radius: 18px;
    box-shadow: var(--login-shadow);
}

.role-select-brand {
    text-align: center;
    margin-bottom: 28px;
}

.role-select-brand img {
    width: min(220px, 70%);
    height: auto;
    max-height: 130px;
    object-fit: contain;
    border-radius: 10px;
}

.role-select-brand h1 {
    margin: 8px 0 4px;
    font-size: 32px;
    font-weight: 600;
}

.role-select-brand p {
    color: var(--login-muted);
    margin: 0;
}

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

.role-tile {
    min-height: 165px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(136, 208, 197, 0.55);
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff, var(--login-soft));
    text-decoration: none;
    color: var(--login-text);
    text-align: center;
    transition: transform .18s ease, box-shadow .18s ease;
}

.role-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.role-tile span {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--login-teal);
}

.role-tile strong {
    font-size: 16px;
    font-weight: 600;
}

.role-tile small {
    color: var(--login-muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    .login-card {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 350px;
    }

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

@media (max-width: 560px) {
    .login-shell,
    .role-select-shell {
        padding: 14px;
    }

    .login-card,
    .role-select-card {
        border-radius: 14px;
    }

    .login-visual,
    .login-form-panel,
    .role-select-card {
        padding: 28px 20px;
    }

    .portal-illustration {
        min-height: 235px;
    }

    .illustration-window {
        width: 210px;
        height: 145px;
        right: 0;
    }

    .illustration-person {
        width: 92px;
        height: 145px;
        font-size: 40px;
    }

    .role-select-grid {
        grid-template-columns: 1fr;
    }
}
