:root {
    --blue: #1264c4;
    --dark: #073a78;
    --gold: #f2b438;
    --line: #dfe9f5;
    --text: #25364d;
    --muted: #71839b
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    color: var(--text);
    background: #edf5fb url("../image/bg.jpg") center/cover fixed
}

.topbar {
    height: 76px;
    padding: 0 5.8%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(5, 47, 99, .94);
    box-shadow: 0 2px 12px #00264a55
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px
}

.brand img {
    max-height: 49px;
    max-width: 180px;
    object-fit: contain
}

.user-info {
    color: #d9edff;
    font-size: 14px
}

.logout {
    margin-left: 16px;
    color: #fff;
    text-decoration: none;
    border: 1px solid #8ab8ec;
    border-radius: 4px;
    padding: 6px 11px
}

.page {
    max-width: 1570px;
    margin: 26px auto;
    padding: 0 24px
}

.panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 28px #0a4b8730
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line)
}

h1 {
    font-size: 20px;
    margin: 0;
    color: var(--dark)
}

.page-title p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted)
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 20px
}

.stat {
    padding: 20px 23px;
    border-left: 4px solid var(--blue)
}

.stat:nth-child(2) {
    border-color: #22a46c
}

.stat:nth-child(3) {
    border-color: #e49a1a
}

.stat:nth-child(4) {
    border-color: #7d5ace
}

.stat label {
    display: block;
    color: var(--muted);
    font-size: 14px
}

.stat strong {
    display: block;
    margin-top: 7px;
    font-size: 30px;
    color: var(--dark)
}

.stat small {
    font-weight: normal;
    font-size: 13px;
    color: var(--muted);
    margin-left: 4px
}

.filter {
    padding: 20px 24px;
    margin-bottom: 20px
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 13px
}

.school-search {
    position: relative;
    min-width: 0
}

.school-search::after {
    content: "▾";
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-52%);
    color: #71839b;
    font-size: 15px;
    pointer-events: none
}

.school-search .input {
    padding-right: 30px
}

.school-options {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 230px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cfdeed;
    border-radius: 4px;
    box-shadow: 0 6px 18px #0a4b8730
}

.school-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font: inherit
}

.school-option:hover {
    background: #edf5fb
}

.input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cfdeed;
    border-radius: 4px;
    outline: none;
    background: #fbfdff;
    color: var(--text)
}

.input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #1264c419
}

.toolbar {
    display: flex;
    justify-content: space-between;
    margin-top: 16px
}

.btn {
    height: 36px;
    border: 0;
    border-radius: 4px;
    padding: 0 17px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: .2s
}

.btn-primary {
    color: #fff;
    background: var(--blue)
}

.btn-primary:hover {
    background: #0956ad
}

.btn-light {
    color: #4a617c;
    background: #eef4fa;
    border: 1px solid #d8e5f0
}

.btn-light:hover {
    background: #e3edf7
}

.table-wrap {
    overflow: auto
}

.data-table {
    width: 100%;
    min-width: 1260px;
    border-collapse: collapse;
    font-size: 13px
}

.data-table th {
    height: 46px;
    background: #f2f7fc;
    color: #48627f;
    font-weight: 600;
    white-space: nowrap
}

.data-table td {
    height: 58px;
    padding: 8px 12px;
    border-top: 1px solid #e6eef6;
    text-align: center;
    white-space: nowrap
}

/* 院校与参赛选手姓名属于较长文本，左对齐便于快速辨识。 */
.data-table td:nth-child(1) {
    vertical-align: middle;
    text-align: left
}

.data-table td:nth-child(2) {
    vertical-align: middle;
    text-align: center
}

/* 成绩包含多项数值，左对齐后更便于逐项核对。 */
.data-table td:nth-child(6) {
    vertical-align: middle;
    text-align: left
}

.data-table tbody tr:hover {
    background: #f7fbff
}

.score {
    font-weight: 700;
    color: #1e9163
}

.score-missing {
    color: #d84747
}

.icon-btn {
    border: 0;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    font-family: inherit;
    padding: 5px
}

.icon-btn:hover {
    text-decoration: underline
}

.file-icon {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: #eef6ff;
    color: #1264c4;
    font-size: 15px
}

.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 17px 24px
}

.page-btn {
    min-width: 31px;
    height: 31px;
    border: 1px solid #d6e2ee;
    background: #fff;
    color: #48627f;
    border-radius: 4px;
    cursor: pointer
}

.page-btn.active {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue)
}

.empty {
    padding: 50px;
    text-align: center;
    color: var(--muted)
}

.modal-mask {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #0b254b88;
    padding: 18px
}

.modal-mask.show {
    display: flex
}

.modal {
    width: min(780px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 9px;
    box-shadow: 0 20px 60px #001b3d66
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 17px 22px;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
    font-weight: 700;
    color: var(--dark)
}

.close {
    font-size: 25px;
    line-height: 1;
    border: 0;
    background: transparent;
    color: #8192a6;
    cursor: pointer
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 22px
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    color: #526a84
}

.required:before {
    content: "*";
    color: #e34b4b;
    margin-right: 3px
}

.upload {
    display: flex;
    align-items: center;
    gap: 10px
}

.upload input {
    max-width: 220px
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line)
}

.toast {
    position: fixed;
    top: 22px;
    left: 50%;
    z-index: 50;
    transform: translateX(-50%);
    display: none;
    padding: 10px 18px;
    color: #fff;
    background: #219365;
    border-radius: 5px;
    box-shadow: 0 5px 15px #0003
}

.toast.show {
    display: block
}

.submit-loading {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35)
}

.submit-loading[hidden] {
    display: none
}

.submit-loading-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    color: #333;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px #0003
}

.submit-loading-card i {
    width: 20px;
    height: 20px;
    border: 3px solid #d9e5e0;
    border-top-color: #219365;
    border-radius: 50%;
    animation: submit-loading-spin .8s linear infinite
}

@keyframes submit-loading-spin {
    to { transform: rotate(360deg) }
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: linear-gradient(120deg, #052e62aa, #0a74c999), url("../image/bg.jpg") center/cover
}

.login-card {
    width: min(440px, 100%);
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 55px #001c4466
}

.login-brand {
    padding: 27px 35px 20px;
    text-align: center;
    background: linear-gradient(135deg, #0a478d, #137bc5)
}

.login-brand img {
    height: 57px;
    max-width: 250px;
    object-fit: contain
}

.login-brand h1 {
    margin: 11px 0 0;
    color: #fff;
    font-size: 21px
}

.login-form {
    padding: 31px 38px 38px
}

.login-form h2 {
    margin: 0 0 8px;
    color: var(--dark);
    font-size: 23px
}

.login-form .tip {
    margin: 0 0 24px;
    color: #8292a5;
    font-size: 14px
}

.login-form .field {
    margin-bottom: 18px
}

.phone-row {
    display: flex;
    gap: 10px
}

.phone-row .input {
    flex: 1
}

.send-btn {
    flex: none;
    width: 112px;
    color: var(--blue);
    background: #edf6ff;
    border: 1px solid #a9caeb
}

.send-btn:disabled {
    color: #9aaaba;
    background: #f2f5f8;
    border-color: #dce3e9;
    cursor: not-allowed
}

.login-error {
    min-height: 20px;
    margin: -8px 0 10px;
    color: #df3f3f;
    font-size: 13px
}

.login-submit {
    width: 100%;
    height: 44px;
    font-size: 16px
}

.login-note {
    margin-top: 20px;
    text-align: center;
    color: #8d9bad;
    font-size: 12px
}

.detail-view,
.history-view {
    padding: 22px
}

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

.detail-grid p {
    margin: 0;
    padding: 10px;
    background: #f6f9fc;
    border-radius: 5px;
    word-break: break-all
}

.detail-grid b {
    display: block;
    margin-bottom: 4px;
    color: #65758a;
    font-size: 12px
}

.detail-view ul {
    padding-left: 20px;
    line-height: 2
}

.history-card {
    position: relative;
    margin-left: 10px;
    padding: 15px 16px 15px 22px;
    border-left: 3px solid var(--blue);
    background: #f7fbff
}

.history-card+.history-card {
    margin-top: 14px
}

.history-card:before {
    content: "";
    position: absolute;
    left: -8px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--blue)
}

.history-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted)
}

.history-card p {
    margin: 9px 0
}

.history-card pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    color: #455
}

.admin-only[hidden] {
    display: none !important
}

@media(max-width:900px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr)
    }

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

@media(max-width:600px) {
    .topbar {
        height: auto;
        min-height: 66px;
        padding: 9px 16px
    }

    .brand {
        font-size: 15px;
        gap: 8px
    }

    .brand img {
        max-width: 120px
    }

    .user-info {
        font-size: 12px
    }

    .logout {
        margin-left: 6px;
        padding: 4px 7px
    }

    .page {
        margin: 16px auto;
        padding: 0 12px
    }

    .stats {
        gap: 10px
    }

    .stat {
        padding: 14px
    }

    .stat strong {
        font-size: 24px
    }

    .filter,
    .page-title {
        padding: 16px
    }

    .filter-grid,
    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr
    }

    .toolbar {
        gap: 10px
    }

    .pagination {
        padding: 14px;
        justify-content: center
    }

    .login-form {
        padding: 27px 23px
    }

    .phone-row {
        gap: 6px
    }

    .send-btn {
        width: 106px
    }

    .modal-mask {
        padding: 8px
    }

    .detail-view,
    .history-view {
        padding: 16px
    }
}

.file-field {
    display: flex;
    flex-direction: column;
    align-items: stretch
}

.file-field .upload-input {
    height: auto;
    min-height: 38px;
    padding: 7px 10px;
    line-height: 1.2
}

.file-field .upload-input::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #1264c4;
    font-family: inherit;
    cursor: pointer
}

.file-current {
    display: block;
    min-height: 18px;
    margin-top: 6px;
    color: #71839b;
    font-size: 12px;
    word-break: break-all
}

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

.document-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 12px 14px;
    border: 1px solid #dbe7f2;
    border-radius: 8px;
    background: #f8fbff
}

.document-card span {
    padding-right: 10px;
    color: #405a78;
    font-size: 14px;
    font-weight: 600
}

.document-card .icon-btn {
    padding: 6px 10px;
    border-radius: 4px;
    background: #e8f2ff
}

@media(max-width:600px) {
    .document-list {
        grid-template-columns: 1fr
    }

    .document-card {
        min-height: 52px
    }
}

.viewer-librarian .reading-upload,
.viewer-librarian .librarian-restricted,
.not-super .super-only {
    display: none !important
}

.stats {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr))
}

.stat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px
}

.stat-tags span {
    padding: 3px 7px;
    border-radius: 12px;
    color: #49708f;
    background: #edf5fc;
    font-size: 12px;
    font-weight: normal
}

.stat strong .stat-tags {
    font-size: 12px
}

.audit-cell { min-width: 92px }
.audit-status-wrap { position: relative; display: inline-block }
.audit-status { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 12px; white-space: nowrap }
.audit-0 { color: #9a6500; background: #fff3d7 }
.audit-1 { color: #167345; background: #e2f6ea }
.audit-2 { color: #b42318; background: #fee4e2 }
.audit-remark { display: block; margin-top: 5px; color: #d92d20; font-size: 12px; line-height: 1.4; word-break: break-all }
.updated-badge { position: absolute; top: -9px; right: -18px; z-index: 1; padding: 2px 5px; border-radius: 9px; color: #fff; background: #e13b32; font-size: 10px; font-style: normal; line-height: 1; white-space: nowrap }
.audit-section { margin-bottom: 0; padding-bottom: 6px }
.audit-actions { margin: 8px 0 2px; text-align: right }
.edit-lock-notice { margin: 14px 20px 0; padding: 10px 12px; border: 1px solid #f5c2c0; border-radius: 6px; color: #b42318; background: #fff2f1 }
.audit-rejection-notice { margin: 14px 20px 0; color: #d92d20; font-size: 14px; line-height: 1.5; font-weight: 600; word-break: break-all }

.filter-librarian-list .data-table .librarian-restricted {
    display: none !important
}

@media(min-width:601px) {
    .topbar {
        height: 92px
    }

    .brand img {
        max-height: 70px;
        max-width: 260px
    }
}

@media(max-width:600px) {
    .topbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 14px
    }

    .brand {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        text-align: center
    }

    .user-info {
        display: block;
        width: 100%;
        padding-top: 3px;
        text-align: center;
        white-space: normal;
        font-size: 12px
    }

    .logout {
        display: table;
        margin: 9px auto 0;
        padding: 5px 12px
    }
}

.login-body {
    background: url("../image/bg.jpg") center/cover
}

.login-page-logo {
    position: fixed;
    top: 36px;
    left: 48px;
    z-index: 1;
    max-width: 420px;
    height: 96px;
    object-fit: contain
}

.login-brand img {
    display: none
}

@media(max-width:600px) {
    .login-page-logo {
        top: 16px;
        right: auto;
        left: 16px;
        max-width: 220px;
        height: 52px
    }
}

.student-list-body .topbar {
    height: 150px;
    padding: 20px 48px;
    align-items: flex-start;
    background: transparent;
    box-shadow: none
}

.student-list-body .brand span {
    display: none
}

.student-list-body .brand img {
    width: 460px;
    max-width: 40vw;
    height: 110px;
    max-height: none;
    object-fit: contain;
    object-position: left top
}

.student-list-body .user-info {
    padding-top: 16px;
    color: var(--dark)
}

.student-list-body .logout {
    color: var(--dark);
    border-color: #5d8fbe;
    background: #ffffffaa
}

@media(max-width:900px) {
    .student-list-body .topbar {
        height: 120px;
        padding: 16px 28px
    }

    .student-list-body .brand img {
        width: 350px;
        max-width: 48vw;
        height: 84px
    }

    .student-list-body .user-info {
        padding-top: 10px
    }
}

@media(max-width:600px) {
    .student-list-body .topbar {
        min-height: 76px;
        height: auto;
        padding: 12px 16px;
        align-items: center
    }

    .student-list-body .brand {
        width: auto
    }

    .student-list-body .brand img {
        width: 220px;
        max-width: 62vw;
        height: 52px
    }

    .student-list-body .user-info {
        width: auto;
        padding-top: 0;
        color: var(--dark);
        text-align: right
    }

    .student-list-body .logout {
        margin-left: 6px
    }
}

.student-list-body .stat:nth-child(5) {
    border-color: #d85c3f
}

.student-list-body .stat:nth-child(6) {
    border-color: #b35fc4
}

.student-list-body .stat:nth-child(7) {
    border-color: #198f9b
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px
}

@media(max-width:600px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch
    }

    .toolbar-actions {
        gap: 8px
    }

    .toolbar-actions .btn {
        flex: 1;
        padding: 0 10px
    }
}

.import-content {
    padding: 24px
}

.import-content p {
    color: #526a84
}

.import-template {
    display: inline-flex;
    align-items: center;
    margin: 6px 0 18px;
    text-decoration: none
}

.import-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px dashed #9ebbd8;
    border-radius: 6px;
    color: #426582;
    background: #f7fbff;
    cursor: pointer
}

.import-file input {
    max-width: 100%;
    font: inherit
}

.import-file-name {
    min-height: 20px;
    margin: 8px 0 18px;
    font-size: 13px
}

.import-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 142px;
    color: #426582
}

.import-loading i {
    width: 22px;
    height: 22px;
    border: 3px solid #c9dced;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: import-spin .8s linear infinite
}

.import-result h3 {
    margin-top: 0;
    color: var(--dark)
}

.import-result b {
    font-size: 18px
}

.success-count {
    color: #1e9163
}

.failure-count {
    color: #df3f3f
}

.import-result details {
    margin-top: 14px
}

.import-result ul {
    max-height: 160px;
    overflow: auto;
    padding-left: 20px;
    color: #df3f3f
}

@keyframes import-spin {
    to {
        transform: rotate(360deg)
    }
}

.import-loading[hidden],
.import-result[hidden] {
    display: none
}

.form-section {
    padding: 22px 22px 0
}

.form-section h3 {
    margin: 0 0 16px;
    color: var(--dark);
    font-size: 16px
}

.form-section .form-grid {
    padding: 0
}

.upload-section {
    padding-bottom: 22px
}

.upload-document-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px
}

.upload-document-list .file-field {
    margin: 0;
    padding: 13px 14px;
    border: 1px solid #dbe7f2;
    border-radius: 8px;
    background: #f8fbff
}

.upload-document-list .file-field label {
    font-weight: 600
}

.upload-document-list .upload-input {
    background: #fff
}

@media(max-width:600px) {
    .form-section {
        padding: 18px 16px 0
    }

    .upload-section {
        padding-bottom: 18px
    }

    .upload-document-list {
        grid-template-columns: 1fr
    }
}

.photo-upload-field {
    grid-column: span 1
}

.photo-upload-field .photo-upload-input {
    height: auto;
    min-height: 38px;
    padding: 7px 10px;
    line-height: 1.2;
    background: #fff
}

.photo-upload-field .photo-upload-input::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #1264c4;
    font-family: inherit;
    cursor: pointer
}

.photo-upload-preview,
.detail-photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    margin-top: 10px
}

.photo-thumb {
    position: relative;
    width: 74px;
    height: 74px;
    overflow: hidden;
    border: 1px solid #cddded;
    border-radius: 6px;
    background: #fff
}

.photo-thumb img,
.detail-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in
}

.photo-thumb button {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 21px;
    height: 21px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: #d84747;
    font-size: 16px;
    line-height: 19px;
    cursor: pointer
}

.detail-photo-list {
    justify-content: flex-end;
    margin: 0
}

.detail-photo {
    width: 70px;
    height: 70px;
    border: 1px solid #cddded;
    border-radius: 6px
}

.photo-document-card {
    align-items: flex-start
}

.image-preview-modal {
    width: min(760px, 100%)
}

.image-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    max-height: 72vh;
    padding: 18px;
    background: #192b3b
}

.image-preview-content img {
    display: block;
    max-width: 100%;
    max-height: 66vh;
    object-fit: contain
}

@media(max-width:600px) {
    .photo-upload-field {
        grid-column: auto
    }

    .photo-thumb {
        width: 68px;
        height: 68px
    }

    .detail-photo {
        width: 60px;
        height: 60px
    }
}

.student-list-body .page {
    position: relative;
    z-index: 2;
    /* 页面不再压入页头区域，避免统计卡片遮挡 Logo。 */
    margin-top: 16px
}
.student-list-body .studentForm label.field-required::before,
.student-list-body #studentForm label.field-required::before { content: '(必填) '; color: #d93025; font-weight: 600; }
.student-list-body .studentForm label.field-optional::before,
.student-list-body #studentForm label.field-optional::before { content: '(选填) '; color: #8a94a6; font-weight: 400; }
