:root {
    --navy: #071c3d;
    --navy-soft: #12365f;
    --burgundy: #8c1d40;
    --burgundy-light: #b52a4f;
    --gold: #d8b76a;
    --ice: #eef6fb;
    --muted: rgba(238, 246, 251, 0.74);
    --line: rgba(255, 255, 255, 0.18);
    --panel-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--ice);
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--navy);
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 34px 20px;
    overflow: hidden;
}

.page-shell::before {
    position: absolute;
    inset: 0;
    z-index: -2;
    content: "";
    background:
        linear-gradient(112deg, rgba(5, 24, 54, 0.96) 0%, rgba(8, 29, 62, 0.88) 34%, rgba(81, 24, 56, 0.72) 65%, rgba(144, 31, 65, 0.9) 100%),
        url("../../images/OstimZemin.png") center bottom / cover no-repeat;
}

.page-shell::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 82px 82px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.62), transparent 72%);
}

.topbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 286px;
    height: 72px;
    padding: 11px 18px;
    border-radius: 18px;
    background: transparent;
}

.brand img {
    display: block;
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}

.portal-label {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    color: rgba(255, 255, 255, 0.86);
    text-align: right;
}

.portal-label span,
.login-panel-heading span {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.portal-label strong,
.login-panel-heading strong {
    color: #ffffff;
    font-size: 1.08rem;
}

.hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    align-items: center;
    gap: 46px;
    min-height: 0;
}

.hero-copy {
    max-width: 780px;
    min-height: 430px;
    padding-top: 56px;
    transform: translateY(28px);
}

.hero-copy h1 {
    max-width: 760px;
    margin: 0;
    color: #ffffff;
    font-size: 4.15rem;
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: 0;
    text-wrap: balance;
    text-shadow: 0 18px 46px rgba(0, 0, 0, 0.44);
}

.lead {
    max-width: 620px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.16rem;
    line-height: 1.58;
}

.signal-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 142px));
    gap: 12px;
    margin-top: 30px;
}

.signal-row div {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(18px);
}

.signal-row span,
.signal-row small {
    display: block;
}

.signal-row span {
    color: #ffffff;
    font-size: 1.46rem;
    font-weight: 800;
}

.signal-row small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.login-panel {
    align-self: center;
    width: 100%;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(7, 25, 52, 0.8), rgba(24, 38, 65, 0.62));
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(24px);
}

.login-panel-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-panel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    color: #ffffff;
    font-size: 1.48rem;
    background: linear-gradient(135deg, var(--burgundy), var(--navy-soft));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 14px 30px rgba(0, 0, 0, 0.24);
}

.login-panel-heading span,
.login-panel-heading strong {
    display: block;
}

.login-panel-heading span {
    color: rgba(255, 255, 255, 0.62);
}

.login-panel-heading strong {
    margin-top: 3px;
    line-height: 1.28;
}

.login-panel .alert {
    border: 0;
    border-radius: 14px;
    font-size: 0.86rem;
}

.login-form .form-label {
    margin-bottom: 0.4rem;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    font-weight: 800;
}

.login-form .input-group-text,
.login-form .form-control {
    min-height: 48px;
    border-color: rgba(255, 255, 255, 0.16);
    color: #172442;
    background: rgba(255, 255, 255, 0.92);
}

.login-form .input-group-text {
    justify-content: center;
    min-width: 48px;
    color: var(--burgundy);
}

.login-form .form-control::placeholder {
    color: rgba(23, 36, 66, 0.5);
}

.login-form .form-control:focus {
    border-color: rgba(216, 183, 106, 0.72);
    box-shadow: 0 0 0 0.2rem rgba(216, 183, 106, 0.18);
}

.login-form .btn-bordo {
    min-height: 48px;
    border: 0;
    color: #ffffff;
    background: linear-gradient(135deg, var(--burgundy), var(--burgundy-light));
    box-shadow: 0 16px 36px rgba(91, 17, 43, 0.34);
}

.login-form .btn-bordo:hover,
.login-form .btn-bordo:focus {
    color: #ffffff;
    background: linear-gradient(135deg, #781633, #a82349);
}

.portal-home .app-footer {
    position: relative;
    z-index: 1;
    width: calc(100% + 68px);
    margin: 0 -34px -20px;
    padding: 0.55rem 1rem 0.85rem;
    border-top: 0;
    text-align: center;
    background: transparent;
}

.portal-home .app-footer small {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.8rem;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.46);
}

.portal-home .app-footer a {
    color: #ffffff;
    font-weight: 800;
}

.portal-home .app-footer a:hover,
.portal-home .app-footer a:focus {
    color: #f1d88c;
}

.portal-home .app-footer-divider {
    color: rgba(255, 255, 255, 0.44);
}

.portal-home .app-cookie-header {
    background: #212348;
}

.portal-home .app-cookie-body {
    color: #64748b;
    font-size: 0.9rem;
}

.portal-panel {
    color: var(--ice);
    background: var(--navy);
    overflow: hidden;
}

.portal-panel .panel-shell {
    flex: 1 0 auto;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.panel-topbar {
    align-items: center;
}

.panel-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    color: rgba(255, 255, 255, 0.78);
    text-align: right;
}

.panel-nav-link,
.panel-nav-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.panel-nav-link {
    color: rgba(255, 255, 255, 0.82);
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.panel-nav-link:hover,
.panel-nav-link:focus,
.panel-nav-link.is-active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.panel-nav-link:hover,
.panel-nav-link:focus {
    transform: translateY(-1px);
}

.panel-nav-user {
    color: rgba(255, 255, 255, 0.72);
}

.panel-nav-menu {
    min-width: 240px;
    border-radius: 14px;
    overflow: hidden;
}

.panel-nav-menu .dropdown-item {
    font-size: 0.82rem;
    font-weight: 700;
}

.portal-panel .panel-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    min-height: 0;
    padding-top: 18px;
}

.panel-definition-window {
    display: none;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 22px;
    background: #f3f5f8;
    box-shadow: var(--panel-shadow);
}

.portal-panel.is-definitions-open .panel-definition-window {
    display: block;
}

.panel-definition-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #f3f5f8;
}

@media (max-height: 760px) {
    .page-shell {
        padding-top: 20px;
        padding-bottom: 16px;
    }

    .brand {
        height: 62px;
    }

    .hero-copy {
        min-height: 360px;
        padding-top: 34px;
        transform: translateY(18px);
    }

    .hero-copy h1 {
        font-size: 3.34rem;
    }

    .lead {
        margin-top: 16px;
        font-size: 1rem;
        line-height: 1.44;
    }

    .signal-row {
        margin-top: 18px;
    }

    .login-panel {
        padding: 20px;
    }

    .login-form .input-group-text,
    .login-form .form-control,
    .login-form .btn-bordo {
        min-height: 42px;
    }

}

@media (max-width: 980px) {
    .page-shell {
        padding: 18px;
    }

    .hero-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .hero-copy {
        max-width: none;
        min-height: 0;
        padding-top: 16px;
        transform: none;
    }

    .hero-copy h1 {
        max-width: 720px;
        font-size: 2.7rem;
    }

    .lead {
        max-width: 680px;
        font-size: 1rem;
    }

    .signal-row {
        display: none;
    }

    .login-panel {
        align-self: stretch;
    }

    .panel-topbar {
        align-items: flex-start;
        gap: 14px;
    }

    .panel-nav {
        justify-content: flex-start;
        text-align: left;
    }

    .portal-home .app-footer {
        width: calc(100% + 36px);
        margin-right: -18px;
        margin-left: -18px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 14px;
    }

    .topbar {
        align-items: flex-start;
    }

    .brand {
        width: 210px;
        height: 58px;
        padding: 10px 14px;
        border-radius: 15px;
    }

    .panel-topbar {
        flex-direction: column;
    }

    .panel-nav {
        width: 100%;
    }

    .panel-nav-link,
    .panel-nav-user {
        min-height: 30px;
        padding: 6px 8px;
        font-size: 0.74rem;
    }

    .portal-label {
        display: none;
    }

    .hero-copy h1 {
        font-size: 2rem;
        line-height: 1.08;
    }

    .lead {
        margin-top: 12px;
        font-size: 0.92rem;
        line-height: 1.42;
    }

    .login-panel {
        padding: 16px;
        border-radius: 20px;
    }

    .login-panel-heading {
        gap: 10px;
        margin-bottom: 14px;
    }

    .login-panel-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 1.18rem;
    }

    .login-panel-heading strong {
        font-size: 0.96rem;
    }

    .portal-home .app-footer {
        width: calc(100% + 28px);
        margin-right: -14px;
        margin-bottom: -14px;
        margin-left: -14px;
    }
}
