:root {
    --navy-950: #030b18;
    --navy-900: #061426;
    --navy-800: #0a213c;
    --text: #f1f6ff;
    --muted: #8da3be;
    --line: rgba(119, 178, 232, .16);
    --blue: #248cff;
    --cyan: #1edfd1;
    --amber: #ffb629;
    --violet: #8862ff;
    --green: #28d79f;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    background: var(--navy-950);
}

body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 50% 30%, rgba(18, 88, 161, .17), transparent 38%),
        linear-gradient(145deg, #061426 0%, #020a16 70%);
}

button, input {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 130px 20px 40px;
    overflow: hidden;
    position: relative;
}

.login-page::before,
.dashboard::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .33;
    background-image:
        linear-gradient(rgba(33, 103, 172, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(33, 103, 172, .12) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, black, transparent 74%);
}

.brand-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    min-height: 106px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px clamp(20px, 4.7vw, 72px);
    border-bottom: 1px solid var(--line);
    background: rgba(3, 13, 27, .72);
    backdrop-filter: blur(14px);
}

.brand-logo {
    display: block;
    max-width: min(32vw, 240px);
    height: 68px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.brand-logo.logo-iist {
    width: 180px;
}

.brand-logo.logo-lactalis {
    width: 180px;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 38px;
    border: 1px solid rgba(110, 174, 238, .18);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(16, 46, 76, .92), rgba(6, 22, 41, .96));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.login-card h1 {
    font-size: clamp(1.8rem, 4vw, 2.35rem);
    text-align: center;
    letter-spacing: -.03em;
}

.login-card .subtitle {
    margin: 10px 0 30px;
    color: var(--muted);
    text-align: center;
}

.login-card label {
    display: block;
    margin: 0 0 8px 2px;
    color: #c6d5e7;
    font-size: .9rem;
    font-weight: 600;
}

.login-card input:not([type="hidden"]) {
    width: 100%;
    margin-bottom: 20px;
    padding: 14px 15px;
    border: 1px solid rgba(120, 175, 228, .17);
    border-radius: 11px;
    outline: none;
    background: rgba(21, 57, 91, .85);
    color: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.login-card input:focus {
    border-color: #54a9ff;
    box-shadow: 0 0 0 3px rgba(36, 140, 255, .14);
}

.primary-button {
    width: 100%;
    padding: 14px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #147cf0, #249cff);
    box-shadow: 0 10px 26px rgba(19, 122, 237, .25);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(19, 122, 237, .35);
}

.error {
    margin-bottom: 18px;
    padding: 11px;
    border: 1px solid rgba(255, 87, 91, .5);
    border-radius: 9px;
    background: rgba(110, 20, 26, .5);
    color: #ff9da0;
    font-size: .9rem;
    text-align: center;
}

.dashboard {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-header {
    position: relative;
    z-index: 3;
    height: clamp(72px, 12vh, 112px);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px clamp(24px, 4.7vw, 72px);
    border-bottom: 1px solid var(--line);
    background: rgba(2, 12, 26, .62);
    backdrop-filter: blur(16px);
}

.header-mark {
    display: flex;
    align-items: center;
}

.header-mark .brand-logo {
    height: 70px;
}

.dashboard-main {
    position: relative;
    z-index: 1;
    width: min(1370px, 100%);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: clamp(16px, 3.5vh, 42px) clamp(22px, 4.5vw, 64px) clamp(12px, 2vh, 24px);
}

.circuit-glow {
    position: absolute;
    z-index: -1;
    left: 50%;
    bottom: 0;
    width: 110vw;
    height: 260px;
    transform: translateX(-50%) perspective(400px) rotateX(55deg);
    transform-origin: bottom;
    opacity: .36;
    background:
        linear-gradient(90deg, transparent 49.5%, rgba(24, 112, 222, .7) 50%, transparent 50.5%),
        linear-gradient(rgba(24, 112, 222, .34) 1px, transparent 1px);
    background-size: 150px 100%, 100% 42px;
    mask-image: linear-gradient(to top, black, transparent);
}

.session-row {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    margin-bottom: clamp(12px, 2.5vh, 26px);
}

.date-time {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #d0dbea;
    font-size: .95rem;
    white-space: nowrap;
}

.date-time span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.date-time .separator {
    width: 1px;
    height: 22px;
    background: rgba(171, 202, 234, .3);
}

.mini-icon {
    width: 19px;
    height: 19px;
    color: #7795b8;
}

.module-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(16px, 2.4vw, 34px);
}

.module-card {
    --accent: var(--blue);
    --accent-rgb: 36, 140, 255;
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 2.5vh, 28px) 20px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent), transparent 38%);
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 12%, rgba(var(--accent-rgb), .15), transparent 42%),
        linear-gradient(150deg, rgba(var(--accent-rgb), .09), rgba(4, 16, 31, .88) 62%);
    box-shadow: inset 0 1px rgba(255, 255, 255, .03), 0 20px 50px rgba(0, 0, 0, .15);
    color: inherit;
    text-decoration: none;
    text-align: center;
    transition: transform .25s, box-shadow .25s, border-color .25s;
}

.module-card::after {
    content: "";
    position: absolute;
    inset: auto 18% -1px;
    height: 1px;
    background: var(--accent);
    box-shadow: 0 0 20px 3px rgba(var(--accent-rgb), .48);
    opacity: 0;
    transition: opacity .25s;
}

.module-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 24px 58px rgba(0, 0, 0, .34), 0 0 30px rgba(var(--accent-rgb), .12);
}

.module-card:hover::after {
    opacity: 1;
}

.module-card.hmi {
    --accent: var(--cyan);
    --accent-rgb: 30, 223, 209;
}

.module-card.control {
    --accent: var(--amber);
    --accent-rgb: 255, 182, 41;
}

.module-card.settings {
    --accent: var(--violet);
    --accent-rgb: 136, 98, 255;
}

.module-card.support {
    --accent: var(--green);
    --accent-rgb: 40, 215, 159;
}

.icon-orbit {
    width: clamp(76px, 13vh, 122px);
    height: clamp(76px, 13vh, 122px);
    display: grid;
    place-items: center;
    margin-bottom: clamp(10px, 2.5vh, 23px);
    border: 1px solid rgba(var(--accent-rgb), .48);
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .035);
    box-shadow: inset 0 0 34px rgba(var(--accent-rgb), .05);
}

.module-icon {
    width: clamp(39px, 6.5vh, 59px);
    height: clamp(39px, 6.5vh, 59px);
    color: var(--accent);
    filter: drop-shadow(0 0 9px rgba(var(--accent-rgb), .34));
}

.module-card h2 {
    color: var(--accent);
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    letter-spacing: -.02em;
}

.module-card p {
    margin: clamp(5px, 1.2vh, 11px) 0 clamp(9px, 2vh, 22px);
    color: var(--muted);
    font-size: .95rem;
}

.arrow-button {
    width: clamp(34px, 5vh, 43px);
    height: clamp(34px, 5vh, 43px);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .18);
    color: var(--accent);
    transition: transform .25s, background .25s;
}

.arrow-button svg {
    width: 23px;
}

.module-card:hover .arrow-button {
    transform: translateX(4px);
    background: rgba(var(--accent-rgb), .28);
}

.dashboard-footer {
    position: relative;
    z-index: 2;
    min-height: clamp(48px, 7vh, 68px);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 26px clamp(10px, 2vh, 18px);
    padding: 10px 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(3, 17, 34, .78);
    color: #8298b3;
    font-size: .88rem;
}

.footer-note,
.system-status {
    display: flex;
    align-items: center;
    gap: 11px;
}

.shield {
    width: 22px;
    color: #5c82ac;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #18c982;
    box-shadow: 0 0 13px rgba(24, 201, 130, .7);
}

@media (max-width: 1020px) {
    .module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        gap: clamp(10px, 1.8vh, 18px);
    }

    .module-card {
        min-height: 0;
        padding: 12px;
    }

    .icon-orbit {
        width: clamp(62px, 10vh, 88px);
        height: clamp(62px, 10vh, 88px);
        margin-bottom: clamp(7px, 1.5vh, 14px);
    }

    .module-icon {
        width: clamp(34px, 5.5vh, 48px);
        height: clamp(34px, 5.5vh, 48px);
    }

    .module-card p {
        margin: 5px 0 9px;
        font-size: .82rem;
    }
}

@media (max-width: 700px) {
    .dashboard-header {
        height: 72px;
        padding: 12px 18px;
    }

    .header-mark .brand-logo {
        width: 120px;
        height: 52px;
    }

    .dashboard-main {
        padding: 14px 14px 10px;
    }

    .session-row {
        display: none;
    }

    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .module-card {
        flex-direction: column;
        justify-content: center;
        padding: 9px 6px;
        text-align: center;
        border-radius: 14px;
    }

    .icon-orbit {
        width: clamp(54px, 10vh, 74px);
        height: clamp(54px, 10vh, 74px);
        margin: 0 0 clamp(5px, 1vh, 9px);
    }

    .module-icon {
        width: clamp(29px, 5vh, 39px);
        height: clamp(29px, 5vh, 39px);
    }

    .module-card h2 {
        font-size: clamp(.94rem, 4vw, 1.2rem);
    }

    .module-card p {
        display: none;
    }

    .arrow-button {
        width: 29px;
        height: 29px;
        margin: 6px 0 0;
    }

    .arrow-button svg {
        width: 17px;
    }

    .dashboard-footer {
        min-height: 42px;
        flex-direction: row;
        align-items: center;
        margin: 0 14px 10px;
        padding: 8px 12px;
        font-size: .8rem;
    }

    .footer-note svg,
    .footer-note span {
        display: none;
    }

    .footer-note::after {
        content: "Secure session";
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .brand-bar {
        min-height: 84px;
        padding: 12px 16px;
    }

    .brand-logo {
        max-width: 42vw;
        height: 52px;
    }

    .login-page {
        padding-top: 110px;
    }

    .login-card {
        padding: 30px 23px;
    }

}

@media (max-height: 650px) {
    .dashboard-header {
        height: 64px;
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .header-mark .brand-logo,
    .dashboard-header > .brand-logo {
        height: 48px;
    }

    .dashboard-main {
        padding-top: 9px;
        padding-bottom: 7px;
    }

    .module-card p {
        display: none;
    }

    .session-row {
        margin-bottom: 7px;
    }

    .icon-orbit {
        width: clamp(48px, 9vh, 64px);
        height: clamp(48px, 9vh, 64px);
        margin-bottom: 5px;
    }

    .module-icon {
        width: clamp(27px, 4.8vh, 36px);
        height: clamp(27px, 4.8vh, 36px);
    }

    .module-card {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .arrow-button {
        width: 28px;
        height: 28px;
        margin-top: 5px;
    }

    .dashboard-footer {
        min-height: 38px;
        margin-bottom: 7px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
