:root {
    --bg: #fbfbfd;
    --surface: #ffffff;
    --border: #e9e7ee;
    --text: #101018;
    --muted: #707080;
    --purple: #9858df;
    --purple-2: #cda9ef;
    --purple-soft: #f4ecfb;
    --blue-soft: #edf5ff;
    --green-soft: #ebfaf4;
    --orange-soft: #fff4e8;
    --shadow: 0 18px 60px rgba(35, 24, 60, .08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background: var(--bg);
}

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

button,
input {
    font: inherit;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-word {
    font-weight: 900;
    letter-spacing: .06em;
    font-size: 34px;
}

.brand-k {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 850;
    font-size: 22px;
    background:
        linear-gradient(
            135deg,
            #f1e4fb,
            #d7b4ed
        );
}

.login-body {
    min-height: 100vh;
    overflow-x: hidden;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 59% 41%;
}

.login-hero {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: 48px 58px;
    background:
        radial-gradient(
            circle at 73% 40%,
            rgba(201, 160, 231, .25),
            transparent 28%
        ),
        linear-gradient(
            135deg,
            #fff,
            #fcf9ff
        );
}

.hero-copy {
    position: relative;
    z-index: 2;
    max-width: 580px;
    margin-top: 120px;
}

.hero-copy h1 {
    margin: 0;
    font-size: clamp(48px, 4.2vw, 72px);
    line-height: .98;
    letter-spacing: -.04em;
}

.hero-subtitle {
    max-width: 520px;
    margin: 26px 0 40px;
    color: var(--muted);
    font-size: 20px;
    line-height: 1.45;
}

.feature-list {
    display: grid;
    gap: 21px;
}

.feature-row {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 18px;
    align-items: start;
}

.feature-row strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.feature-row p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
    max-width: 430px;
}

.feature-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 24px;
}

.histology-grid {
    position: absolute;
    z-index: 1;
    right: -60px;
    top: 45px;
    width: 620px;
    height: 860px;
    opacity: .22;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    gap: 11px;
    transform: rotate(1deg);
}

.histology-grid div {
    border-radius: 18px;
    background:
        radial-gradient(
            circle at 30% 30%,
            #9f69c9 0 2px,
            transparent 3px
        ),
        repeating-radial-gradient(
            ellipse at 60% 40%,
            rgba(139, 83, 184, .45) 0 2px,
            rgba(238, 220, 247, .7) 3px 9px
        );
}

.histology-grid div:nth-child(2n) {
    transform: translateY(70px);
}

.login-panel-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    border-left: 1px solid #f2eef6;
    background:
        linear-gradient(
            160deg,
            #fdfbff,
            #f8f5fb
        );
}

.login-card {
    width: min(490px, 100%);
    padding: 46px;
    background: rgba(255,255,255,.86);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(
            135deg,
            #e5c9f3,
            #cfabe7
        );
    border-radius: 16px;
    font-size: 37px;
    font-weight: 900;
}

.login-card h2 {
    text-align: center;
    font-size: 26px;
    margin: 0 0 5px;
}

.center {
    text-align: center;
}

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

.login-card label {
    display: block;
    margin: 22px 0 8px;
    font-size: 14px;
    font-weight: 650;
}

.form-input {
    width: 100%;
    padding: 14px 15px;
    border-radius: 10px;
    border: 1px solid #dcd9e2;
    background: #fff;
    outline: none;
}

.form-input:focus {
    border-color: var(--purple);
    box-shadow:
        0 0 0 3px
        rgba(152,88,223,.12);
}

.login-options {
    margin: 17px 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    font-size: 12px;
}

.login-options .remember {
    margin: 0;
    white-space: nowrap;
}

.primary-button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    color: white;
    font-weight: 700;
    background:
        linear-gradient(
            90deg,
            #aa63e4,
            #8d4bd3
        );
}

.primary-button:hover {
    filter: brightness(.97);
}

.secure-note {
    margin: 30px -46px -46px;
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

.flash {
    margin: 18px 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.flash.error {
    background: #fff0f0;
    color: #9b3434;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 245px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 25px 17px 21px;
    background: #fff;
    border-right: 1px solid var(--border);
}

.sidebar-brand {
    padding: 0 8px 26px;
}

.sidebar-brand .brand-word {
    font-size: 27px;
}

.sidebar-brand .brand-k {
    width: 34px;
    height: 34px;
    font-size: 17px;
    border-radius: 8px;
}

.nav {
    display: grid;
    gap: 7px;
}

.nav-item {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 13px 14px;
    border-radius: 10px;
    color: #363243;
    font-size: 14px;
}

.nav-item:hover {
    color: #7f3ac2;
    background: var(--purple-soft);
}

.nav-item span {
    width: 20px;
    font-size: 19px;
    text-align: center;
    color: #574f68;
}

.sidebar-spacer {
    flex: 1;
}

.user-box {
    padding: 16px 8px;
    display: flex;
    gap: 11px;
    align-items: center;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--purple-soft);
    color: var(--purple);
    font-weight: 750;
}

.user-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.user-copy strong {
    font-size: 13px;
}

.user-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
}

.logout-button {
    width: 100%;
    margin-top: 4px;
    padding: 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    color: var(--muted);
    cursor: pointer;
}

.main-content {
    padding: 28px 31px 50px;
    overflow-x: hidden;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0 0 5px;
    letter-spacing: -.025em;
    font-size: 29px;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

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

.metric-card {
    min-height: 125px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
}

.metric-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 21px;
}

.metric-icon.purple {
    background: var(--purple-soft);
    color: var(--purple);
}

.metric-icon.blue {
    background: var(--blue-soft);
    color: #4387db;
}

.metric-icon.green {
    background: var(--green-soft);
    color: #2ba873;
}

.metric-icon.lilac {
    background: #f6effb;
    color: #9b61cb;
}

.metric-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 650;
}

.metric-value {
    display: block;
    margin-bottom: 5px;
    font-size: 28px;
    line-height: 1;
}

.metric-value.status-text {
    font-size: 19px;
    margin-top: 9px;
}

.metric-card small {
    color: var(--muted);
}

.lab-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns:
        repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.lab-card {
    min-height: 214px;
    padding: 22px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    transition:
        transform .15s ease,
        box-shadow .15s ease;
}

.lab-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.lab-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 22px;
}

.lab-card h3 {
    margin: 0 0 9px;
}

.lab-card p {
    min-height: 80px;
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.lab-card span {
    color: var(--purple);
    font-size: 13px;
    font-weight: 650;
}

.system-panel {
    margin-top: 18px;
    padding: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.panel-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.health-pill {
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.health-pill.healthy {
    background: #e6f8ef;
    color: #20845a;
}

.health-pill.degraded {
    background: #fff2dd;
    color: #a86a10;
}

.runtime-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.runtime-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.runtime-item span,
.runtime-item small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.runtime-item strong {
    display: block;
    margin: 6px 0;
}

.coming-card {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.coming-card p {
    max-width: 540px;
    color: var(--muted);
    line-height: 1.55;
}

.coming-icon {
    width: 75px;
    height: 75px;
    margin-bottom: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 17px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 34px;
    font-weight: 900;
}

.secondary-button {
    margin-top: 15px;
    padding: 11px 17px;
    border-radius: 9px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 13px;
    font-weight: 650;
}

@media (max-width: 1250px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .login-hero {
        display: none;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .metric-grid,
    .lab-grid,
    .runtime-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 20px;
    }
}
