:root {
    --ims-blue: #112a63;
    --ims-blue-2: #0a4fa3;
    --ims-border: #d9e1ee;
    --ims-bg: #f4f6fa;
    --ims-card: #ffffff;
    --ims-text: #17233c;
    --ims-muted: #5f6d82;
    --ims-danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--ims-bg);
    color: var(--ims-text);
    font-family: Arial, sans-serif;
}

a {
    color: inherit;
}

.portal-shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

.login-panel,
.projects-view {
    width: 100%;
    background: var(--ims-card);
    border: 1px solid var(--ims-border);
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(17, 42, 99, 0.12);
}

.login-panel {
    max-width: 440px;
    padding: 34px;
}

.brand-link,
.portal-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-link img {
    height: 70px;
    margin-bottom: 20px;
}

.portal-logo img {
    height: 58px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    color: var(--ims-blue);
    font-size: 2rem;
    line-height: 1.15;
}

h2 {
    margin-bottom: 0;
    color: var(--ims-blue);
    font-size: 1.15rem;
}

.muted {
    color: var(--ims-muted);
}

.alert {
    margin: 22px 0;
    padding: 12px 14px;
    border: 1px solid #f1b8b3;
    border-radius: 8px;
    background: #fff3f1;
    color: var(--ims-danger);
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 26px;
}

.login-form label {
    display: grid;
    gap: 7px;
    color: var(--ims-blue);
    font-weight: 700;
}

.login-form input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--ims-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ims-text);
    font-size: 1rem;
}

.login-form input:focus {
    outline: 3px solid rgba(10, 79, 163, 0.16);
    border-color: var(--ims-blue-2);
}

.login-form button,
.project-link {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--ims-blue);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.login-form button {
    margin-top: 8px;
}

.login-form button:hover,
.project-link:hover {
    background: var(--ims-blue-2);
}

.site-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--ims-blue-2);
    font-weight: 700;
    text-decoration: none;
}

.site-link:hover,
.logout-link:hover {
    text-decoration: underline;
}

.projects-view {
    padding: 30px;
}

.portal-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ims-border);
}

.portal-header h1 {
    margin-bottom: 4px;
}

.portal-header p {
    margin-bottom: 0;
}

.logout-link {
    color: var(--ims-blue-2);
    font-weight: 700;
    text-decoration: none;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.project-card {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--ims-border);
    border-radius: 8px;
    background: #fbfcff;
}

.project-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.project-card-head span {
    flex: 0 0 auto;
    border-radius: 999px;
    background: #e8eef8;
    color: var(--ims-blue);
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 700;
}

.project-card p {
    margin-bottom: auto;
    color: var(--ims-muted);
}

.project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 9px 14px;
}

.project-card-disabled {
    opacity: 0.72;
}

.project-link-disabled {
    background: #d7deea;
    color: #56657b;
    cursor: default;
}

.project-link-disabled:hover {
    background: #d7deea;
}

@media (max-width: 860px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .portal-header {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .portal-shell {
        width: min(100% - 20px, 1120px);
        align-items: flex-start;
        padding-top: 18px;
    }

    .login-panel,
    .projects-view {
        padding: 22px;
    }

    h1 {
        font-size: 1.65rem;
    }
}
