:root {
    color-scheme: light;
    font-family: Inter, "Microsoft JhengHei", "PingFang TC", sans-serif;
    color: #142e2b;
    background: #f3f7f5;
}

* { box-sizing: border-box; }
body { margin: 0; }
.shell { width: min(100% - 2rem, 62rem); margin-inline: auto; }

.space-login {
    min-height: 100vh;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: clamp(1rem, 5vw, 3.5rem);
    background: #eef4f9;
}

.space-login-card {
    width: min(100%, 39rem);
    padding: clamp(1.25rem, 5vw, 2.75rem);
    border: 1px solid #d7e3ed;
    border-radius: 1rem;
    background: #fff;
    color: #24384a;
    line-height: 1.7;
}

.space-login-card h1 {
    margin: 0 0 1.5rem;
    text-align: center;
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    line-height: 1.4;
}

.space-login-card h2 { margin: 1.5rem 0 .5rem; font-size: 1.1rem; }
.space-login-card a { color: #165b9d; }
.space-login-notice {
    padding: .75rem 1rem;
    border-left: .25rem solid #3474ad;
    background: #edf5fd;
}

.space-login-accounts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .35rem 1rem;
    margin: 0;
    padding: .8rem 1rem;
    background: #f3f7fa;
}

.space-login-accounts dt { font-weight: 700; }
.space-login-accounts dd { margin: 0; overflow-wrap: anywhere; }
.space-login-card .space-login-button {
    display: block;
    margin-top: 1.5rem;
    padding: .7rem 1rem;
    border-radius: .45rem;
    background: #27649b;
    color: #fff;
    text-align: center;
    font-weight: 700;
    text-decoration: none;
}

.space-login-card .space-login-button:hover { background: #1c507f; }

@media (max-width: 26rem) {
    .space-login-accounts { grid-template-columns: 1fr; }
    .space-login-accounts dd:not(:last-child) { margin-bottom: .35rem; }
}

.site-header {
    background: #fff;
    border-bottom: 1px solid #d8e4df;
}

.header-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    padding-block: .85rem;
}

.portal-link, .logout {
    color: #174e43;
    font-weight: 700;
    text-decoration: none;
}

.portal-link:hover { text-decoration: underline; }

.logout {
    display: inline-block;
    padding: .55rem 1rem;
    border: 1px solid #a8c4bb;
    border-radius: .55rem;
    background: #fff;
    font-family: inherit;
    font-size: .95rem;
    cursor: pointer;
}

.logout:hover { background: #eaf4ee; }

.hero {
    margin-top: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2rem);
    border-radius: 1.25rem;
    background: linear-gradient(120deg, #103e36, #1e6452);
    color: #fff;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 1.5rem);
    line-height: 1.2;
}

.hero p { margin: .85rem 0 0; color: #e3f2eb; overflow-wrap: anywhere; }
.hero .test-notice { color: #fff0bc; }

.admin-hero {
    margin-top: .625rem;
    padding: .625rem clamp(1rem, 4vw, 2rem);
}

.admin-hero h1 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
.admin-hero p { margin-top: .25rem; }

.services { padding-block: 2rem 3rem; }
.services h2 { margin: 0 0 1rem; font-size: 1.3rem; }

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: .85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-menu-rows { display: grid; gap: 1.5rem; }
.admin-menu-row { grid-template-columns: repeat(var(--admin-menu-columns, 3), minmax(0, 1fr)); }
.admin-menu-row > li { grid-column: var(--admin-menu-column, auto); }
.admin-menu-row .service-link { min-height: 3.5rem; padding-block: .55rem; }

@media (max-width: 40rem) {
    .admin-menu-row { grid-template-columns: 1fr; }
    .admin-menu-row > li { grid-column: auto; }
}

.service-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 100%;
    min-height: 5rem;
    padding: 1rem 1.2rem;
    border: 1px solid #d2e0da;
    border-radius: .85rem;
    background: #fff;
    color: #142e2b;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
}

.service-link:hover { border-color: #478572; background: #edf6f0; }
.service-link span { color: #21604d; font-size: 1.25rem; }
:focus-visible { outline: 3px solid #125f99; outline-offset: 3px; }

.service-link .download-action {
    color: #174e43;
    font-size: .9rem;
    white-space: nowrap;
}

.service-unavailable {
    display: grid;
    align-content: center;
    gap: .25rem;
    height: 100%;
    min-height: 5rem;
    padding: 1rem 1.2rem;
    border: 1px solid #d2e0da;
    border-radius: .85rem;
    background: #eaf0ed;
    color: #3f5750;
}

.service-unavailable span { font-size: .9rem; }

.simulation-form {
    display: grid;
    gap: .65rem;
    max-width: 32rem;
    margin-block: 1.5rem 3rem;
    padding: clamp(1rem, 4vw, 2rem);
    border: 1px solid #d2e0da;
    border-radius: .85rem;
    background: #fff;
}

.simulation-form label { font-weight: 700; }
.simulation-form input { font: inherit; }
.simulation-form input[type="text"],
.simulation-form input[type="password"] {
    width: 100%;
    min-height: 2.75rem;
    margin-bottom: .5rem;
    padding: .5rem .75rem;
    border: 1px solid #a8c4bb;
    border-radius: .5rem;
}

.primary-action {
    min-height: 2.75rem;
    padding: .5rem 1rem;
    border: 0;
    border-radius: .5rem;
    background: #174e43;
    color: #fff;
    cursor: pointer;
}

.primary-action:hover { background: #103e36; }
.form-error { margin: 0; color: #922b21; }

.download-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.download-columns h3 { margin: 0 0 .75rem; }

.download-list {
    display: grid;
    gap: .85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 40rem) {
    .download-columns { grid-template-columns: 1fr; }
}
