:root {
    --green: #007A32;
    --green-dark: #005C26;
    --teal: #2AA78E;
    --yellow: #D9A21B;
    --orange: #D2571F;
    --red: #C43A26;
    --cream: #F7F4EC;
    --ink: #24312A;
    --sub: #6B7A70;
    --line: #E8E4D8;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--cream);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: 15px;
    min-height: 100vh;
}

/* 顶栏 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 0;
}

.topbar .logo { height: 52px; }
.topbar .logo.company { height: 46px; }

.wrap { max-width: 520px; margin: 0 auto; padding: 0 14px 40px; }

/* 主视觉 */
.hero { padding: 14px 6px 4px; }
.hero-tag {
    display: inline-block;
    background: #E2F3E8;
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
}
.hero-title {
    margin-top: 10px;
    font-size: 34px;
    font-weight: 800;
    color: var(--green-dark);
    letter-spacing: 3px;
}
.hero-sub { margin-top: 6px; color: var(--sub); font-size: 13px; }

/* Tab */
.tabs { display: flex; gap: 8px; margin: 16px 0 14px; }
.tab {
    flex: 1;
    padding: 10px 0;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--sub);
    font-size: 14px;
    cursor: pointer;
}
.tab.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    font-weight: 700;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 卡片 */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(36, 49, 42, 0.05);
}

.tip {
    background: #FBF6E8;
    border: 1px solid #F0E3C2;
    color: #8A6D1C;
    font-size: 12.5px;
    line-height: 1.7;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

/* 表单 */
.field { margin-bottom: 16px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; }
.required { color: var(--red); }
.input {
    width: 100%;
    background: #F7F6F0;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 15px;
    color: var(--ink);
    outline: none;
    appearance: none;
}
.input:focus { border-color: var(--green); background: #fff; }
.select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%23A8B2AA' stroke-width='1.6' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}
.form-error { color: var(--red); font-size: 13px; margin-bottom: 12px; }

.field-hint { margin-top: 7px; font-size: 12px; color: #A8B2AA; }

.btn-primary {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 0;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.btn-primary:disabled { background: #9CC7AB; }
.btn-ghost {
    background: #fff;
    color: var(--green);
    border: 1.5px solid var(--green);
    border-radius: 999px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}
.btn-block { display: block; }

.note .note-title { font-weight: 700; margin-bottom: 8px; }
.note p { color: var(--sub); font-size: 12.5px; line-height: 1.9; }

/* 纪录榜 */
.cat-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.cat-bar::-webkit-scrollbar { display: none; }
.cat-item {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid var(--line);
    color: #4A5750;
    font-size: 13px;
    cursor: pointer;
}
.cat-item.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

.record-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(36, 49, 42, 0.05);
}
.record-head { display: flex; justify-content: space-between; align-items: center; }
.record-name { font-weight: 700; font-size: 16px; }
.record-cat {
    font-size: 11px;
    color: var(--teal);
    background: #E6F5F1;
    padding: 2px 10px;
    border-radius: 999px;
}
.record-body { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.record-result { font-size: 28px; font-weight: 800; color: var(--orange); }
.record-unit { font-size: 12px; font-weight: 500; color: var(--sub); margin-left: 3px; }
.record-holder { text-align: right; font-size: 12px; color: var(--sub); }
.record-holder b { display: block; color: var(--green); font-size: 16px; margin-top: 2px; }
.record-empty {
    margin-top: 10px;
    background: #F7F6F0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    color: #B8C2BA;
    font-size: 13px;
}
.record-empty b { font-size: 17px; }

/* 状态徽标 */
.chip {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.chip-pending { background: #FBF0DC; color: #B07708; }
.chip-approved { background: #E2F3E8; color: var(--green); }
.chip-rejected { background: #FBE7E1; color: var(--red); }

/* 我的报名 */
.reg-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(36, 49, 42, 0.05);
}
.reg-head { display: flex; justify-content: space-between; align-items: center; }
.reg-project { font-weight: 700; font-size: 16px; }
.reg-meta { margin-top: 8px; color: var(--sub); font-size: 13px; }
.reg-time { margin-top: 6px; color: #A8B2AA; font-size: 12px; }
.reg-review { margin-top: 10px; background: #F7F6F0; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--sub); line-height: 1.7; }
.reg-hint { margin-top: 10px; background: #FBF0DC; color: #B07708; border-radius: 8px; padding: 9px 12px; font-size: 12px; }

.empty { text-align: center; color: #8A968E; padding: 50px 0; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; }

/* 页脚 */
.footer { text-align: center; color: #A8B2AA; font-size: 12px; line-height: 1.9; padding-top: 16px; }
.admin-link { display: inline-block; margin-top: 6px; color: #B8C2BA; font-size: 12px; }

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%);
    background: rgba(36, 49, 42, 0.92);
    color: #fff;
    font-size: 14px;
    padding: 11px 20px;
    border-radius: 10px;
    max-width: 80vw;
    text-align: center;
    z-index: 99;
}

/* ===== 管理后台 ===== */
.summary { display: flex; text-align: center; padding: 16px 0; }
.sum-item { flex: 1; display: flex; flex-direction: column; }
.sum-item b { font-size: 22px; font-weight: 800; }
.sum-item span { margin-top: 4px; font-size: 12px; color: var(--sub); }
.c-green { color: var(--green); }
.c-orange { color: var(--orange); }
.c-red { color: var(--red); }
.c-green-b { color: var(--green); font-weight: 700; }

.filters { display: flex; gap: 10px; margin-bottom: 12px; }
.filters .input { padding: 9px 30px 9px 12px; font-size: 13.5px; }

.reg-sub { font-size: 12.5px; color: var(--sub); font-weight: 500; margin-left: 6px; }
.reg-meta b { font-weight: 700; }
.reg-actions { display: flex; gap: 10px; margin-top: 12px; }

.rec-none { color: #B8C2BA; font-size: 13px; }
.rec-toggle { cursor: pointer; }
.toggle-arrow { color: #C2CCC4; font-size: 15px; }
.edit-panel { margin-top: 12px; border-top: 1px solid #F0EEE6; padding-top: 12px; }
.edit-panel .field { margin-bottom: 12px; }
.edit-panel .label { font-size: 13px; color: #4A5750; }

.page-tip {
    margin: 0 4px 12px;
    font-size: 12.5px;
    color: var(--sub);
    background: #E6F5F1;
    border-radius: 8px;
    padding: 9px 12px;
}
.logout-wrap { padding: 8px 4px 20px; }
.admin-body { background: var(--cream); }

/* 新增项目卡片 */
.add-card .note-title { font-weight: 700; margin-bottom: 10px; }
.add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.add-row .input { flex: 1; min-width: 0; font-size: 13.5px; padding: 9px 10px; }
.act-promote {
    margin-top: 10px;
    width: 100%;
    background: #2AA78E;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.act-del {
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--red);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
}

.rec-cat-line { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ===== 新增：活动日期 / 状态条 / 挑战排期 / 成绩 / 修改报名 ===== */
.hero-date {
    display: inline-block;
    margin-top: 10px;
    font-size: 20px;
    font-weight: 800;
    font-style: italic;
    color: var(--orange);
    letter-spacing: 1px;
}

.status-banner {
    background: #FBE7E1;
    color: var(--red);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 12px;
    font-weight: 600;
}
.status-banner.info {
    background: #FBF0DC;
    color: #8A6208;
}

.sch-row {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
    line-height: 1.6;
}
.sch-row:last-child { border-bottom: none; }
.sch-project { flex: none; width: 118px; font-weight: 700; color: var(--green); }
.sch-detail { color: var(--sub); }
.sch-detail b { color: var(--ink); font-weight: 600; }

.attempt-box {
    margin-top: 10px;
    background: #F2F7F1;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--sub);
}
.attempt-box .a-val { color: var(--orange); font-weight: 800; font-size: 15px; }
.attempt-box .a-gap { color: #8A6208; }
.attempt-line { display: flex; justify-content: space-between; }

.reg-edit {
    margin-top: 12px;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}
.reg-edit .field { margin-bottom: 10px; }
.reg-edit .field .label { font-size: 12.5px; }
.btn-mini {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--green);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}
.btn-mini.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-mini.danger { color: var(--red); }

/* 管理端新增 */
.export-row { display: flex; gap: 10px; margin: 4px 0 14px; }
.export-row .btn-mini { flex: 1; text-align: center; }
.settings-block { margin-bottom: 16px; }
.settings-block .label { display: block; margin-bottom: 8px; }
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
}
.switch-row b { font-size: 14.5px; }
.switch-row .sw-hint { font-size: 12px; color: var(--sub); margin-top: 3px; }
.switch {
    width: 52px; height: 30px; border-radius: 16px; background: #D8D3C4;
    position: relative; flex: none; border: none; transition: background .18s;
}
.switch.on { background: var(--green); }
.switch::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
    border-radius: 50%; background: #fff; transition: left .18s;
}
.switch.on::after { left: 25px; }
.att-line { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.att-line:last-child { border-bottom: none; }

/* ===== 纪录榜：男女双列 / 重量分组 / 前五名 ===== */
.g-row { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.g-label {
    flex: none; width: 46px; border-radius: 8px; background: #2AA78E; color: #fff;
    font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
    letter-spacing: .5px;
}
.g-cols { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-col { background: #F8F6EF; border-radius: 10px; padding: 9px 12px; min-height: 74px; }
.g-sex { font-size: 11px; font-weight: 700; color: #9AA79F; letter-spacing: 3px; }
.g-val { display: flex; align-items: baseline; gap: 3px; margin-top: 2px; }
.g-result { font-size: 25px; font-weight: 800; color: #D2571F; line-height: 1.15; }
.g-result.none { color: #C9C3B4; font-size: 20px; }
.g-unit { font-size: 11.5px; color: #6B7A70; }
.g-holder { font-size: 12px; color: #007A32; font-weight: 600; margin-top: 3px; }
.g-holder.none { color: #B5BEB6; font-weight: 400; }

.record-note {
    margin-top: 9px; font-size: 11.5px; color: #8A6A16; background: #FBF3DE;
    border-radius: 7px; padding: 7px 10px; line-height: 1.5;
}
.top5-toggle {
    margin-top: 10px; border: none; background: #EEF3EE; color: #007A32;
    font-size: 12.5px; font-weight: 700; border-radius: 8px; padding: 9px 14px; width: 100%;
}
.top5 { margin-top: 10px; border-top: 1px dashed #E8E4D8; padding-top: 10px; }
.top5-block { margin-bottom: 10px; }
.top5-group {
    display: inline-block; font-size: 11.5px; color: #fff; background: #2AA78E;
    border-radius: 5px; padding: 1px 7px; margin-bottom: 6px;
}
.top5-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.top5-title { font-size: 11.5px; color: #9AA79F; font-weight: 700; margin-bottom: 4px; letter-spacing: 2px; }
.top5-line { display: flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1.95; }
.top5-line i { font-style: normal; width: 14px; color: #B5BEB6; font-size: 11px; }
.t5-name { flex: 1; color: #24312A; }
.t5-name em { font-style: normal; color: #9AA79F; font-size: 11px; }
.top5-line b { color: #D2571F; }

/* ===== 管理端：男女分组编辑 ===== */
.adm-pill { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.adm-pill.f { background: #FBEAF0; color: #993556; }
.adm-pill.m { background: #E6F1FB; color: #185FA5; }
.grp-block { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed #E8E4D8; }
.grp-title { font-size: 12px; font-weight: 800; color: #2AA78E; margin-bottom: 7px; letter-spacing: 1px; }
.adm-row { display: flex; gap: 7px; align-items: center; margin-bottom: 7px; }
.adm-row .input { flex: 1; min-width: 0; }
.adm-sex { flex: none; width: 26px; text-align: center; font-size: 12px; font-weight: 800; border-radius: 6px; padding: 6px 0; }
.adm-sex.f { background: #FBEAF0; color: #993556; }
.adm-sex.m { background: #E6F1FB; color: #185FA5; }
.g-holder em { font-style: normal; font-size: 11px; color: #8A9A90; margin-right: 4px; }

/* ===== 性别选择 ===== */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-btn {
    padding: 12px 0; border-radius: 10px; border: 1.5px solid #E8E4D8; background: #fff;
    color: #6B7A70; font-size: 15px; font-weight: 600; font-family: inherit;
}
.seg-btn.active { border-color: #007A32; background: #EAF3DE; color: #007A32; }

/* ===== 报名项目快捷标签（替代 datalist，避免遮挡键盘） ===== */
.proj-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.proj-chip {
    border: 1px solid #E8E4D8; background: #fff; color: #6B7A70;
    border-radius: 15px; padding: 6px 13px; font-size: 13px; font-family: inherit;
    line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proj-chip.active { border-color: #007A32; background: #EAF3DE; color: #007A32; font-weight: 600; }

/* ---------- 一键分享 ---------- */
.share-entry { margin-top: 18px; }
.share-entry button {
    width: 100%; padding: 12px 0;
    border: 1.5px dashed var(--green);
    border-radius: 12px; background: #fff;
    color: var(--green); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.share-entry button:active { background: #EAF3DE; }

.share-modal {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center;
}
.share-modal[hidden] { display: none; }
.share-mask { position: absolute; inset: 0; background: rgba(20,28,23,0.55); }
.share-panel {
    position: relative;
    width: min(92vw, 380px); max-height: 92vh;
    background: #fff; border-radius: 18px; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.share-head { display: flex; align-items: center; justify-content: space-between; }
.share-head span { font-weight: 700; color: var(--ink); font-size: 15px; }
.share-close {
    border: none; background: none; font-size: 26px; line-height: 1;
    color: var(--sub); cursor: pointer; padding: 0 4px;
}
.share-stage {
    overflow: auto; border-radius: 12px;
    background: var(--cream); border: 1px solid var(--line);
}
.share-stage img { display: block; width: 100%; }
.share-actions { display: flex; gap: 10px; }
.share-actions .btn-primary { flex: 1.4; padding: 11px 0; margin: 0; }
.btn-outline {
    flex: 1; padding: 11px 0;
    border: 1.5px solid var(--line); border-radius: 12px;
    background: #fff; color: var(--ink); font-size: 14px;
    cursor: pointer; font-family: inherit;
}
.btn-outline:active { background: var(--cream); }
.share-tip { font-size: 12px; color: var(--sub); text-align: center; }

/* ---------- 单项纪录分享 ---------- */
.record-head { gap: 8px; }
.record-name { flex: 1; min-width: 0; }
.record-share {
    flex: none; border: 1.5px solid var(--green); background: #fff; color: var(--green);
    font-size: 12px; font-weight: 600; padding: 4px 13px; border-radius: 999px;
    cursor: pointer; font-family: inherit; line-height: 1.4;
}
.record-share:active { background: #EAF3DE; }

/* 分享弹窗：性别 / 组别切换 */
.share-seg { display: flex; gap: 8px; }
.share-seg[hidden] { display: none; }
.share-seg button {
    flex: 1; padding: 8px 0; border: 1.5px solid var(--line); border-radius: 10px;
    background: #fff; color: var(--sub); font-size: 13px; font-family: inherit; cursor: pointer;
}
.share-seg button.active {
    border-color: var(--green); background: #EAF3DE; color: var(--green); font-weight: 700;
}

/* 找回报名 */
.claim-card { margin-top: 14px; }
.claim-tip { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 6px 0 12px; }

/* ---------- 各年级第一 ---------- */
.grade-top {
    margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.gt-title {
    font-size: 11px; color: var(--sub); letter-spacing: .4px; margin-bottom: 5px;
}
.gt-row {
    display: grid; grid-template-columns: 44px 1fr 1fr; align-items: center;
    gap: 2px 8px; padding: 2px 0;
}
.gt-row b {
    font-size: 11px; font-weight: 700; color: var(--green-dark);
}
.gt-cell {
    display: flex; align-items: center; gap: 3px; min-width: 0; font-size: 11px; color: var(--ink);
}
.gt-cell i {
    font-style: normal; font-size: 10px; font-weight: 700;
    padding: 0 3px; border-radius: 3px; flex: none;
}
.gt-cell i.gt-f { color: var(--red); background: #FBEAE7; }
.gt-cell i.gt-m { color: var(--teal); background: #E4F3EF; }
.gt-cell .gt-val { font-weight: 700; flex: none; }
.gt-cell em {
    font-style: normal; color: var(--sub); min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gt-cell.none .gt-val { color: #BFC8C1; font-weight: 400; }

/* 各年级第一折叠按钮 */
.gt-toggle {
    margin-top: 10px; border: none; background: #EEF3EE; color: #007A32;
    font-size: 12.5px; font-weight: 700; border-radius: 8px; padding: 9px 14px; width: 100%;
}
.gt-toggle:active { background: #E0EBE0; }
