:root {
    color-scheme: light;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --canvas: #f3f6fc;
    --wash: #e4edff;
    --surface: #fff;
    --ink: #131e42;
    --muted: #4b5877;
    --border: #b7c5e3;
    --accent: #2538eb;
    --accent-hover: #192ad2;
    --focus: #5063f3;
}

* { box-sizing: border-box; }

body.portal {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    place-items: center;
    margin: 0;
    padding: 24px 18px;
    background: radial-gradient(ellipse at 50% 47%, var(--wash), var(--canvas) 75%);
    color: var(--ink);
}

.portal-card {
    width: min(100%, 444px);
    padding: 36px 34px 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 10px 45px #15295706;
}

.portal-heading { text-align: center; }

.portal-mark {
    position: relative;
    display: block;
    width: 48px;
    height: 38px;
    margin: 0 auto 22px;
    overflow: hidden;
    border-radius: 9px;
    color: #fff;
    background: var(--accent);
}

.portal-mark::after {
    position: absolute;
    top: -3px;
    left: 11px;
    width: 25px;
    height: 25px;
    border: solid currentColor;
    border-width: 0 4px 4px 0;
    border-radius: 0 0 4px;
    transform: rotate(45deg) skew(-7deg, -7deg);
    content: "";
}

.portal h1 {
    margin: 0;
    font-size: clamp(27px, 6vw, 35px);
    font-weight: 750;
    line-height: 1.24;
    letter-spacing: -.04em;
}

.portal-domain { margin: 8px 0 26px; color: var(--muted); font-size: 18px; }
.portal-form { display: grid; gap: 15px; }
.portal-field, .portal #login-form tr { display: grid; gap: 8px; }
.portal label { display: block; font-size: 15px; font-weight: 650; }

.portal input:not([type=hidden]) {
    width: 100%;
    min-width: 0;
    height: 45px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

.portal input:not([type=hidden]):focus,
.portal-address:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px #5063f321; }

.portal-address {
    display: flex;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.portal .portal-address input:not([type=hidden]) { border: 0; border-radius: 0; box-shadow: none; }
.portal-address span {
    display: grid;
    flex: none;
    place-items: center;
    padding: 0 11px;
    border-inline-start: 1px solid var(--border);
    background: #f1f4fa;
    color: var(--muted);
    font-size: 13px;
}

.portal-button {
    display: grid;
    width: 100%;
    min-height: 48px;
    place-items: center;
    margin-top: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.portal-button:hover { background: var(--accent-hover); }
.portal-button:focus-visible, .portal-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.portal-nav { margin: 19px 0 0; text-align: center; }
.portal-link { color: var(--accent-hover); text-underline-offset: 3px; font-size: 15px; font-weight: 650; }

.portal #login-form table, .portal #login-form tbody { display: grid; gap: 15px; width: 100%; }
.portal #login-form td { display: block; padding: 0; }
.portal #login-form .portal-button { margin-top: 21px; }

.portal-notice, #messagestack .alert {
    margin: 0 0 18px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff2ee;
    color: #8c2f1b;
    font-size: 14px;
    overflow-wrap: anywhere;
}

#messagestack:empty { display: none; }
.portal-success { margin: 0 0 18px; text-align: center; overflow-wrap: anywhere; }

@media (max-width: 450px) {
    .portal-card { padding: 28px 22px 24px; }
    .portal-mark { margin-bottom: 17px; }
    .portal-domain { margin-bottom: 23px; }
}
