:root {
    --ink: #17263a;
    --ink-2: #56657a;
    --line: #e5eaf1;
    --bg: #f3f6fa;
    --card: #ffffff;
    --brand: #0f3b66;
    --brand-2: #18578f;
    --blue: #1672d4;
    --green: #1a9c6b;
    --red: #d9443f;
    --radius: 16px;
    --shadow: 0 6px 24px rgba(15, 59, 102, .08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

/* ---------------- 公共 ---------------- */
.wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 12px;
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
    line-height: 1.2;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand-2), var(--brand));
    color: #fff;
    box-shadow: 0 6px 16px rgba(15, 59, 102, .22);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(15, 59, 102, .28); }
.btn-block { width: 100%; padding: 13px 18px; font-size: 16px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-ghost {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
}
.btn-outline {
    background: #fff;
    color: var(--brand-2);
    border: 1px solid #cfdbea;
}
.btn-danger {
    background: #fff;
    color: var(--red);
    border: 1px solid #f0c9c7;
}
.btn-danger:hover { background: #fff6f5; }

.flash {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}
.flash.ok { background: #e8f7f0; color: #12734f; border: 1px solid #bfe8d6; }
.flash.error { background: #fdeeed; color: #a82f2b; border: 1px solid #f5cdcb; }

.empty {
    text-align: center;
    padding: 64px 20px;
    color: var(--ink-2);
}
.empty svg { width: 56px; height: 56px; color: #c3cfdd; margin-bottom: 14px; }
.empty p { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.empty span { font-size: 13px; }

.foot {
    text-align: center;
    padding: 24px 16px 36px;
    color: #8b99ab;
    font-size: 12px;
}
.foot p + p { margin-top: 6px; }
.foot-tip { color: #a6b2c2; }

/* ---------------- 首页 ---------------- */
.hero {
    background:
        radial-gradient(120% 90% at 85% -10%, rgba(82, 168, 255, .38) 0%, rgba(82, 168, 255, 0) 55%),
        linear-gradient(145deg, #123f6d 0%, #0f3b66 45%, #0b2f52 100%);
    color: #fff;
    padding: calc(env(safe-area-inset-top, 0px) + 30px) 0 34px;
    border-radius: 0 0 26px 26px;
}
.hero-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.brand-mark svg { width: 27px; height: 27px; color: #d9ecff; }
.brand-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
}
.brand-text p {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(222, 238, 255, .78);
}

.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 22px 2px 12px;
    font-size: 16px;
    font-weight: 700;
}
.list-head .count {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-2);
}

.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .2s ease;
    position: relative;
    overflow: hidden;
}
.card:active { transform: scale(.985); }
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(22, 114, 212, .06), rgba(22, 114, 212, 0));
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.card:hover::after, .card.is-loading::after { opacity: 1; }

.file-icon {
    width: 46px;
    height: 54px;
    flex: 0 0 46px;
    border-radius: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 9px;
    position: relative;
    color: #fff;
    background: #8a99ad;
    overflow: hidden;
}
.file-icon::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, .32);
    clip-path: polygon(0 0, 100% 100%, 100% 0);
}
.file-icon span {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    line-height: 1;
}
.file-icon.pdf { background: linear-gradient(160deg, #e0574f, #c2302a); }
.file-icon.word { background: linear-gradient(160deg, #3d7ce0, #2558b0); }
.file-icon.excel { background: linear-gradient(160deg, #2fa576, #167a52); }
.file-icon.ppt { background: linear-gradient(160deg, #e2844a, #c55a1e); }
.file-icon.zip { background: linear-gradient(160deg, #9a86dd, #6c54bd); }
.file-icon.img { background: linear-gradient(160deg, #4cb3b0, #28807e); }
.file-icon.other { background: linear-gradient(160deg, #8a99ad, #66758a); }

.card-body { flex: 1; min-width: 0; }
.card-title {
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}
.card-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 7px;
}
.card-meta i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #c3cedc;
    font-style: normal;
}
.dl-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef4fc;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 11px;
}
.dl-btn svg { width: 15px; height: 15px; }

/* ---------------- 登录 ---------------- */
.page-login {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(90% 60% at 50% 0%, rgba(40, 110, 190, .35), rgba(40, 110, 190, 0) 60%),
        linear-gradient(160deg, #0f3b66, #0a2a49 55%, #071d33);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: #fff;
    border-radius: 22px;
    padding: 34px 26px 26px;
    box-shadow: 0 24px 60px rgba(2, 16, 32, .38);
}
.login-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border-radius: 17px;
    background: linear-gradient(145deg, #eaf3ff, #d7e8fb);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-logo svg { width: 29px; height: 29px; color: var(--brand-2); }
.login-card h1 {
    font-size: 20px;
    text-align: center;
    font-weight: 700;
}
.login-sub {
    text-align: center;
    color: var(--ink-2);
    font-size: 13px;
    margin-top: 5px;
    margin-bottom: 22px;
}
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form label { display: flex; flex-direction: column; gap: 7px; }
.login-form label span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-form input {
    border: 1px solid #dbe4ef;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s ease, background .2s ease;
}
.login-form input:focus {
    border-color: #7fb0e6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 114, 212, .1);
}
.login-form .btn { margin-top: 4px; }
.login-back {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--ink-2);
}

/* ---------------- 后台 ---------------- */
.page-admin { background: var(--bg); }
.topbar {
    background: linear-gradient(135deg, #123f6d, #0c3155);
    color: #fff;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 14px;
}
.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title strong { font-size: 17px; letter-spacing: .5px; }
.topbar-title span {
    font-size: 12px;
    color: rgba(214, 233, 255, .72);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.inline-form { display: inline-flex; margin: 0; }

.admin-wrap { max-width: 960px; padding-top: 20px; }

.panel {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head p { font-size: 12px; color: var(--ink-2); }

.upload-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input[type="text"] {
    border: 1px solid #dbe4ef;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s ease, background .2s ease;
}
.field input[type="text"]:focus {
    border-color: #7fb0e6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 114, 212, .1);
}
.file-field input[type="file"] {
    border: 1px dashed #c7d5e6;
    background: #f8fafc;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13.5px;
    color: var(--ink-2);
    width: 100%;
}
.file-field input[type="file"]::file-selector-button {
    border: 0;
    background: #e8f1fc;
    color: var(--brand-2);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    margin-right: 10px;
    cursor: pointer;
    font-family: inherit;
}
.hint { font-size: 12px; color: #8b99ab; text-align: center; }

.admin-list { display: flex; flex-direction: column; }
.admin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.admin-item:first-child { border-top: 0; padding-top: 0; }
.admin-item-main {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 1 1 320px;
    min-width: 0;
}
.admin-item-info { min-width: 0; }
.admin-item-info h3 {
    font-size: 15px;
    font-weight: 600;
    word-break: break-all;
}
.admin-item-info p {
    margin-top: 5px;
    font-size: 12px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}
.admin-item-info p i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #c3cedc;
}
.admin-item-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.editor { position: relative; }
.editor summary {
    list-style: none;
    user-select: none;
}
.editor summary::-webkit-details-marker { display: none; }
.editor summary::after {
    content: "";
}
.edit-form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    width: min(330px, calc(100vw - 60px));
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 16px 40px rgba(15, 40, 70, .18);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.empty-sm { padding: 36px 16px; }
.empty-sm p { font-size: 14px; }
.empty-sm span { font-size: 12px; }

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 560px) {
    .admin-item { align-items: flex-start; }
    .admin-item-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
        padding-top: 2px;
    }
    .edit-form {
        position: static;
        width: 100%;
        margin-top: 10px;
        box-shadow: none;
        border-style: dashed;
    }
    .editor { flex: 1; }
    .editor[open] { flex-basis: 100%; }
    .topbar-title span { max-width: 40vw; }
    .card { padding: 12px; gap: 11px; }
    .dl-btn { padding: 9px 10px; }
    .dl-btn span { display: none; }
    .dl-btn svg { width: 17px; height: 17px; }
}

@media (min-width: 700px) {
    .hero { padding-top: 46px; padding-bottom: 46px; }
    .brand-text h1 { font-size: 24px; }
    .list-head { font-size: 17px; padding-top: 28px; }
}

/* ---------------- 底部公司信息 & 微信二维码弹窗 ---------------- */
.foot-company {
    font-size: 14px;
    font-weight: 700;
    color: #3a4a60;
    margin-bottom: 10px;
    letter-spacing: .3px;
}
.foot-contact { margin-bottom: 10px; }
.wechat-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #1aad19;
    background: #fff;
    color: #1aad19;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
    padding: 9px 20px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .12s ease;
}
.wechat-btn:active { transform: scale(.96); }
.wechat-btn:hover { background: #1aad19; color: #fff; }
.wechat-btn svg { width: 18px; height: 18px; }

.qr-mask {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(8, 18, 32, .62);
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 16px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}
.qr-mask.is-open {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
}
.qr-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 20px 18px 16px;
    width: 260px;
    max-width: 84vw;
    max-height: 86vh;
    overflow-y: auto;
    margin: auto;
    text-align: center;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    box-shadow: 0 16px 48px rgba(2, 16, 32, .35);
    -webkit-animation: qr-pop .22s ease;
    animation: qr-pop .22s ease;
}
@-webkit-keyframes qr-pop {
    from { opacity: 0; -webkit-transform: translateY(14px) scale(.96); }
    to { opacity: 1; -webkit-transform: translateY(0) scale(1); }
}
@keyframes qr-pop {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.qr-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 0;
    background: #f1f4f8;
    color: #66758a;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1;
}
.qr-close:active { background: #e2e8f0; }
.qr-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0; }
.qr-sub { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 12px; }
.qr-img {
    width: 200px;
    max-width: 70vw;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    display: block;
    margin: 0 auto;
}
.qr-tip { margin: 12px 0 0; font-size: 12px; color: #8b99ab; }
