:root {
    color-scheme: light;
    --ink: #17343a;
    --muted: #5f7074;
    --line: #d7cbbb;
    --line-strong: #b9aa98;
    --paper: #fffdf7;
    --panel: rgba(255, 255, 250, .96);
    --field-bg: #ffffff;
    --soft: #edf5f0;
    --accent: #0f766e;
    --accent-dark: #0a4f4a;
    --gold: #c4874b;
    --danger: #b42318;
    --warning: #936308;
    --shadow: 0 22px 60px rgba(23, 52, 58, .14);
    --sheet-width: 868px;
    --page-width: 916px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px 0 34px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: var(--ink);
    font: 12px/1.35 "Noto Serif SC", "Times New Roman", "SimSun", "Microsoft YaHei", serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(196, 135, 75, .20), transparent 30rem),
        radial-gradient(circle at 92% 10%, rgba(15, 118, 110, .16), transparent 28rem),
        linear-gradient(135deg, #f7efe4 0%, #edf5f0 54%, #f9f0df 100%);
}

.page {
    width: var(--page-width);
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 18px 20px 16px;
    border: 1px solid rgba(255, 255, 255, .74);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.sheet-page {
    overflow-x: auto;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.page.narrow {
    width: min(720px, calc(100% - 32px));
}

.portal-page {
    width: min(980px, calc(100vw - 48px));
    margin-top: 42px;
}

.portal-head {
    margin-bottom: 28px;
}

.portal-head h1 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 44px;
    line-height: 1.1;
    letter-spacing: .02em;
}

.portal-head p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.portal-title-en {
    margin-bottom: 8px !important;
    color: var(--accent-dark) !important;
    font-size: 24px !important;
    font-weight: 800;
    line-height: 1.2;
}

.portal-intro {
    display: grid;
    gap: 2px;
}

.portal-intro span {
    display: block;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.portal-card {
    display: block;
    min-height: 104px;
    padding: 26px 24px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid rgba(215, 203, 187, .95);
    border-radius: 22px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 22px 54px rgba(23, 52, 58, .10);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.portal-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 118, 110, .35);
    box-shadow: 0 26px 64px rgba(23, 52, 58, .15);
}

.portal-card strong {
    display: block;
    margin-bottom: 10px;
    color: #082b33;
    font-size: 23px;
    line-height: 1.2;
}

.portal-card span {
    color: var(--muted);
    font-size: 15px;
}

.sheet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: var(--sheet-width);
    max-width: none;
    margin: 0 auto 12px;
    color: var(--accent-dark);
}

.sheet-toolbar.no-switch {
    justify-content: flex-start;
}

.sheet-toolbar strong {
    display: block;
    font-size: 16px;
}

.sheet-toolbar span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.language {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 3px;
    border: 1px solid rgba(15, 118, 110, .35);
    border-radius: 999px;
    background: #fff;
}

.language a {
    display: block;
    padding: 4px 11px;
    color: var(--accent-dark);
    text-decoration: none;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 800;
}

.language a.active {
    background: var(--accent);
    color: #fff;
}

form {
    margin: 0;
}

.sheet {
    width: var(--sheet-width);
    margin: 0 auto;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--paper);
    border: 1px solid var(--line-strong);
    box-shadow: 0 12px 34px rgba(23, 52, 58, .08);
}

.sheet td {
    height: 24px;
    padding: 2px 4px;
    border: 1px solid var(--line);
    vertical-align: middle;
}

.sheet-title {
    height: 34px !important;
    text-align: center;
    color: var(--accent-dark);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .08em;
    background: linear-gradient(90deg, rgba(15, 118, 110, .12), rgba(196, 135, 75, .10));
}

.label-cell {
    text-align: center;
    color: var(--ink);
    background: #fbf7ef;
    font-weight: 700;
    white-space: normal;
}

.section-title {
    text-align: center;
    color: var(--accent-dark);
    background: #e8f2ed;
    line-height: 17px;
    font-weight: 800;
    letter-spacing: .06em;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.section-title-text {
    display: inline-block;
}

.section-title-en {
    position: relative;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    letter-spacing: .03em;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
    padding: 0 !important;
}

.section-title-en .section-title-text {
    position: absolute;
    top: 50%;
    left: 50%;
    white-space: nowrap;
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center;
}

.subhead td,
.subhead {
    text-align: center;
    color: var(--accent-dark);
    background: #f5efe5;
    font-weight: 800;
}

.req {
    color: var(--danger);
    font-weight: 800;
    padding-right: 2px;
}

.sheet input[type="text"],
.sheet input[type="date"],
.sheet textarea {
    width: 100%;
    min-height: 20px;
    border: 1px solid #c4b7a6;
    border-radius: 4px;
    padding: 2px 5px;
    color: #0b2630;
    background: var(--field-bg);
    font: 12px "Noto Serif SC", "Times New Roman", "SimSun", "Microsoft YaHei", serif;
    outline: none;
}

.sheet textarea {
    display: block;
    resize: vertical;
}

.sheet input:focus,
.sheet textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, .16);
}

.sheet-options {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
    min-height: 22px;
}

.sheet-options label {
    white-space: nowrap;
    cursor: pointer;
    font-weight: 700;
}

.sheet input[type="radio"],
.sheet input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0 3px 0 0;
    vertical-align: -2px;
    accent-color: var(--accent);
}

.file-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 1px solid #c4b7a6;
    border-radius: 4px;
    padding: 3px;
    background: #fff;
    color: #0b2630;
    min-height: 28px;
}

.file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 1px 10px;
    border: 1px solid #b7aa98;
    border-radius: 3px;
    background: #f8f4ed;
    color: var(--ink);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.file-button:hover {
    background: #efe8dd;
}

.file-name {
    min-width: 0;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-hint {
    margin-top: 4px;
    color: var(--muted);
}

.obs {
    min-height: 58px;
    padding: 8px 10px !important;
    color: #59412a;
    background: #fff7ed;
    font-weight: 700;
    line-height: 1.55;
}

.spacer {
    height: 18px !important;
    background: var(--paper);
}

.notes-title {
    height: 30px !important;
    color: var(--accent-dark);
    background: #e8f2ed;
    text-align: left;
    font-weight: 800;
    letter-spacing: .06em;
}

.actions {
    text-align: center;
    padding: 10px 0 2px;
}

.sheet-actions {
    width: var(--sheet-width);
    margin: 0 auto;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    min-width: 150px;
    padding: 4px 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 118, 110, .22);
}

button:hover,
.button-link:hover {
    background: linear-gradient(135deg, #12867c, var(--accent-dark));
}

.alert {
    width: 790px;
    margin: 0 auto 12px;
    padding: 10px 12px;
    border: 1px solid rgba(180, 35, 24, .22);
    border-radius: 14px;
    background: #fff7ed;
    color: var(--danger);
    font-weight: 700;
}

.alert ul,
.result ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.result {
    margin-top: 60px;
    padding: 24px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.brand {
    margin: 0 0 8px;
    color: var(--accent);
    font-weight: 700;
}

.result h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.result.ok {
    border-top: 4px solid var(--accent);
}

.result.warn {
    border-top: 4px solid var(--warning);
}

.result dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 18px;
    margin: 24px 0;
}

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

.result dd {
    margin: 0;
    font-weight: 700;
}

@media (max-width: 820px) {
    body {
        padding: 10px 0 20px;
    }

    .page {
        width: calc(100vw - 16px);
        padding: 10px;
        border-radius: 18px;
    }

    .sheet-toolbar {
        width: var(--sheet-width);
    }

    .portal-page {
        width: calc(100vw - 24px);
        margin-top: 22px;
    }

    .portal-head h1 {
        font-size: 34px;
    }

    .portal-title-en {
        font-size: 20px !important;
    }

    .portal-grid {
        grid-template-columns: 1fr;
    }
}
