/* ==========================================================================
   JSON 卡密兑换系统 · 样式表
   零依赖，单文件。配色：靛蓝 + 中性灰，浅色主题。
   ========================================================================== */

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: #e5e7eb;
    --line-soft: #f1f3f7;

    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-ink: #3730a3;
    --brand-soft: #eef2ff;

    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warn: #b45309;
    --warn-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
    --shadow-lg: 0 18px 40px -12px rgba(30, 41, 59, .18);
    --ring: 0 0 0 4px rgba(79, 70, 229, .14);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- 文本工具 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.ta-r { text-align: right; }
.link { color: var(--brand); }
.link:hover { text-decoration: underline; }
.sep { color: var(--faint); }
.opt { color: var(--faint); font-weight: 400; }

.grad-text {
    background: linear-gradient(92deg, var(--brand) 10%, var(--brand-2) 55%, #db2777 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 22px;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease,
        box-shadow .16s ease, transform .16s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #6366f1 55%, var(--brand-2));
    box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55);
}
.btn-primary:hover { box-shadow: 0 10px 22px -8px rgba(79, 70, 229, .65); transform: translateY(-1px); }
.btn-primary:disabled:hover { transform: none; box-shadow: none; }

.btn-soft { color: var(--brand-ink); background: var(--brand-soft); border-color: #e0e7ff; }
.btn-soft:hover { background: #e5e9ff; }

.btn-ghost { color: var(--ink-2); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; color: var(--ink); }

.btn-danger-ghost { color: #b91c1c; background: var(--surface); border-color: #fecaca; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #fca5a5; }

.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 27px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; font-weight: 500; }
.btn-block { width: 100%; }

.btn-ico { width: 17px; height: 17px; }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--faint);
    font-size: 12.5px;
    transition: color .15s ease;
}
.link-btn:hover { color: #e2e8f0; }

/* ==========================================================================
   前台框架
   ========================================================================== */
body.page-public {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(900px 380px at 50% -140px, rgba(99, 102, 241, .13), transparent 70%),
        var(--bg);
}

.site-head {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 64px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: linear-gradient(140deg, #6366f1, #7c3aed);
    box-shadow: 0 4px 10px -3px rgba(79, 70, 229, .5);
    color: #fff;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -1px;
}

.brand-name {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.head-nav { display: flex; align-items: center; gap: 18px; }
.head-nav a { font-size: 13.5px; color: var(--muted); transition: color .15s ease; }
.head-nav a:hover { color: var(--ink); }

.nav-ghost {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-2) !important;
    font-size: 12.5px !important;
    font-weight: 500;
}
.nav-ghost:hover { border-color: #c7d2fe; color: var(--brand) !important; }

.main { flex: 1; padding: 38px 0 64px; }

.site-foot { border-top: 1px solid var(--line); background: rgba(255, 255, 255, .5); }
.foot-inner {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    padding: 20px 0;
    font-size: 12px;
    color: var(--faint);
}

/* ==========================================================================
   首页 Hero
   ========================================================================== */
.hero { position: relative; padding: 54px 0 24px; text-align: center; }

.hero-grid-bg {
    position: absolute;
    inset: -40px 0 0;
    background-image:
        linear-gradient(to right, rgba(99, 102, 241, .07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(99, 102, 241, .07) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(closest-side at 50% 34%, #000 35%, transparent 100%);
    mask-image: radial-gradient(closest-side at 50% 34%, #000 35%, transparent 100%);
    pointer-events: none;
}

.hero-inner { position: relative; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px 6px 10px;
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
    box-shadow: var(--shadow-sm);
}

.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 0 rgba(79, 70, 229, .45);
    animation: pulse 2.4s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, .45); }
    70% { box-shadow: 0 0 0 7px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.hero h1 {
    margin: 20px 0 14px;
    font-size: clamp(32px, 5.4vw, 54px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.hero-sub {
    max-width: 560px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 15.5px;
    line-height: 1.75;
}

.code-form { max-width: 620px; margin: 30px auto 0; }

.code-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.code-box:focus-within { border-color: #a5b4fc; box-shadow: var(--shadow-lg), var(--ring); }

.code-ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--faint); }

.code-box input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 4px;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1.6px;
}
.code-box input::placeholder { color: #cbd5e1; font-weight: 400; letter-spacing: 1.2px; }

.hero-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    margin-top: 18px;
    font-size: 12.5px;
    color: var(--muted);
}
.hero-note span { display: inline-flex; align-items: center; gap: 6px; }
.hero-note i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ok-soft);
    color: var(--ok);
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
}

/* ---------- 步骤 ---------- */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 52px;
}

.step {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.step-no {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--brand);
}
.step h3 { margin: 8px 0 6px; font-size: 14.5px; font-weight: 700; }
.step p { color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* ==========================================================================
   面板 / 表格 / 徽标
   ========================================================================== */
.panel {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.panel:last-child { margin-bottom: 0; }

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.panel-head p { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.panel-head-row { align-items: center; flex-wrap: wrap; }

.head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: #f3f4f6;
}
.tab {
    padding: 6px 13px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 14px;
    padding: 6px 12px;
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 12px;
}
.filter-chip a { color: var(--brand); text-decoration: underline; }

.table-wrap { width: 100%; overflow-x: auto; }

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

.table th {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fafbff; }

.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.cell-name {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-file .file-name { min-width: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: #047857; }
.badge-info { background: var(--brand-soft); color: var(--brand-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: #f3f4f6; color: var(--muted); }
.badge-bad { background: var(--danger-soft); color: #b91c1c; }
.badge-lg { padding: 5px 12px; font-size: 12.5px; }

.code-cell { display: flex; align-items: center; gap: 8px; }
.code-text { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; }
.code-cell.big { margin-top: 5px; }
.code-cell.big .code-text { font-size: 20px; letter-spacing: .12em; }

.copy-btn {
    padding: 3px 7px;
    border: 0;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 11px;
    font-weight: 500;
    transition: background .15s ease;
}
.copy-btn:hover { background: #e0e7ff; }

.quota-mini { display: flex; flex-direction: column; gap: 5px; width: 104px; }
.quota-num { font-size: 12px; color: var(--muted); }
.quota-num b { color: var(--ink); font-size: 13px; }

.bar {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef0f5;
}
.bar > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}
.bar-lg { height: 9px; margin-top: 10px; }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
a.pg:hover { border-color: #c7d2fe; color: var(--brand); background: #f8faff; }
.pg.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.pg.is-disabled { opacity: .4; pointer-events: none; }

/* ---------- 空状态 / 提示 ---------- */
.empty {
    padding: 46px 22px;
    border: 1px dashed #dbe1ea;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
}
.empty-sm { padding: 26px 18px; border: 0; border-radius: 0; background: transparent; }
.empty-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: #f1f5f9;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
}
.empty h3 { font-size: 15px; font-weight: 700; }
.empty p { margin-top: 6px; font-size: 12.5px; }
.empty .btn { margin-top: 16px; }

.notice {
    margin-bottom: 16px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.65;
}
.notice a { color: inherit; font-weight: 700; text-decoration: underline; }
.notice-danger { border-color: #fecaca; background: var(--danger-soft); color: #991b1b; }
.notice-warn { border-color: #fde68a; background: var(--warn-soft); color: #92400e; }
.notice-info { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand-ink); }

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    animation: slideIn .22s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
.flash-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.flash-text { flex: 1 1 auto; }
.flash-x {
    flex: 0 0 auto;
    padding: 0 2px;
    border: 0;
    background: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: .55;
}
.flash-x:hover { opacity: 1; }
.flash-success { border-color: #a7f3d0; background: var(--ok-soft); color: #065f46; }
.flash-error { border-color: #fecaca; background: var(--danger-soft); color: #991b1b; }
.flash-info { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand-ink); }
.flash-warn { border-color: #fde68a; background: var(--warn-soft); color: #92400e; }

/* ==========================================================================
   表单
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .01em;
}

.field input,
.field select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: #cbd5e1; }
.field input:focus,
.field select:focus {
    outline: 0;
    border-color: #a5b4fc;
    box-shadow: var(--ring);
}
.field input[type="date"] { color: var(--ink-2); }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.gen-form { margin: 0; }
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.hint { color: var(--faint); font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.search-mini { position: relative; display: flex; align-items: center; }
.search-mini svg {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: var(--faint);
    pointer-events: none;
}
.search-mini input {
    width: 210px;
    height: 38px;
    padding: 0 12px 0 33px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-mini input::placeholder { color: #cbd5e1; }
.search-mini input:focus { outline: 0; border-color: #a5b4fc; box-shadow: var(--ring); }

.select {
    height: 38px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 12.5px;
    color: var(--ink-2);
    max-width: 190px;
}

/* ==========================================================================
   卡密条 / 文件选择
   ========================================================================== */
.card-strip {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 26px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.cs-item { display: flex; flex-direction: column; gap: 3px; }
.cs-label { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; }
.cs-code { font-size: 13.5px; font-weight: 600; letter-spacing: .06em; }
.cs-value { font-size: 15px; font-weight: 700; line-height: 1.2; }
.cs-value b { font-size: 21px; letter-spacing: -.02em; }
.cs-value.sm { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.cs-total { font-size: 12px; font-weight: 500; color: var(--faint); }
.cs-divider { width: 1px; height: 34px; background: var(--line); }
.cs-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cs-actions form { margin: 0; }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}
.section-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.section-head p { margin-top: 4px; font-size: 12.5px; }

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.file-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.file-card:hover { border-color: #c7d2fe; box-shadow: var(--shadow-sm); }
.file-card:has(input:checked) {
    border-color: #818cf8;
    background: #f7f6ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
}
.file-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.file-card input[data-file] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
}
.file-ico.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 10px; }
.file-ico.xs { width: 26px; height: 26px; border-radius: 7px; font-size: 9px; }

.file-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 600;
}
.file-meta { font-size: 11.5px; color: var(--faint); }

.tick {
    position: relative;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: var(--surface);
    transition: background .15s ease, border-color .15s ease;
}
.file-card:has(input:checked) .tick { border-color: var(--brand); background: var(--brand); }
.file-card:has(input:checked) .tick::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(42deg);
}

.action-bar {
    position: sticky;
    bottom: 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 14px 12px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}
.ab-info { font-size: 12.5px; color: var(--muted); }
.ab-info b { color: var(--ink); font-size: 14px; }
.ab-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 下载列表 ---------- */
.dl-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.dl-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 17px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .12s ease;
}
.dl-row:last-child { border-bottom: 0; }
.dl-row:hover { background: #fafbff; }
.dl-main { flex: 1 1 auto; min-width: 0; }
.dl-main .file-name { font-size: 13px; }
.dl-main .file-meta { margin-top: 2px; }
.foot-hint { margin-top: 12px; font-size: 11.5px; color: var(--faint); }

/* ==========================================================================
   管理后台
   ========================================================================== */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 232px;
    height: 100vh;
    flex: 0 0 auto;
    padding: 18px 14px;
    background:
        radial-gradient(400px 200px at 0% 0%, rgba(99, 102, 241, .22), transparent 70%),
        #0b1020;
    color: #cbd5e1;
}

.brand-admin { padding: 4px 6px 0; color: #fff; }
.brand-admin .brand-name { color: #fff; }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 24px; }

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.side-link svg { width: 17px; height: 17px; flex: 0 0 auto; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.side-link.is-active {
    background: rgba(99, 102, 241, .18);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .22);
}

.side-foot {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.side-ext { font-size: 12px; color: #94a3b8; transition: color .15s ease; }
.side-ext:hover { color: #e2e8f0; }
.side-foot form { margin: 0; }

.admin-main { flex: 1 1 auto; min-width: 0; background: var(--bg); }

.admin-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 64px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.admin-top h1 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }

.admin-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(140deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.admin-content { max-width: 1180px; padding: 24px 28px 52px; }

/* ---------- 统计卡 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.stat-dot.ok { background: #10b981; }
.stat-dot.brand { background: #6366f1; }
.stat-dot.info { background: #3b82f6; }
.stat-dot.warn { background: #f59e0b; }
.stat-dot.bad { background: #ef4444; }
.stat-value {
    margin: 9px 0 3px;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.15;
}
.stat-sub { font-size: 11.5px; color: var(--faint); }

.dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.quick-list { display: flex; flex-direction: column; gap: 6px; }
.quick {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    transition: background .15s ease, border-color .15s ease;
}
.quick:hover { background: #fafbff; border-color: var(--line); }
.quick-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
}
.quick b { display: block; font-size: 12.5px; font-weight: 600; }
.quick small { display: block; margin-top: 1px; font-size: 11.5px; color: var(--faint); }
.quick-arrow { margin-left: auto; color: #cbd5e1; font-size: 14px; }

/* ---------- 上传 ---------- */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 32px 20px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
    background: #fafbff;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover,
.dropzone.is-drag { border-color: #818cf8; background: #f5f3ff; }

.dz-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-bottom: 2px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 20px;
    font-weight: 700;
}
.dz-title { font-size: 13.5px; font-weight: 600; }
.dz-hint { font-size: 11.5px; color: var(--faint); }

.dz-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
}
.dz-list:empty { display: none; }
.dz-list span,
.dz-list div {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 260px;
    padding: 3px 9px;
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ---------- 卡密详情 ---------- */
.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.back-link { font-size: 12.5px; color: var(--muted); }
.back-link:hover { color: var(--ink); }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-soft);
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 28px;
    margin-top: 20px;
}
.detail-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.detail-value { font-size: 13px; font-weight: 500; }
.quota-big { font-size: 13px; color: var(--muted); }
.quota-big b { font-size: 26px; color: var(--ink); letter-spacing: -.02em; }

.kv { margin: 0; }
.kv > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
}
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; word-break: break-all; }

/* ==========================================================================
   登录 / 空白页 / 错误页
   ========================================================================== */
body.page-blank {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(720px 420px at 50% 0%, rgba(99, 102, 241, .16), transparent 70%),
        radial-gradient(500px 300px at 90% 100%, rgba(139, 92, 246, .12), transparent 70%),
        var(--bg);
}

.blank-wrap { width: 100%; display: flex; justify-content: center; }

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
    padding: 34px 32px 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; }
.login-brand .brand-mark { width: 44px; height: 44px; margin: 0 auto; border-radius: 12px; font-size: 14px; }
.login-card h1 { margin: 14px 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; text-align: center; }
.login-sub { text-align: center; font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    font-size: 11.5px;
}
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--ink); }

.error-page { padding: 76px 20px; text-align: center; }
.err-code {
    font-size: 80px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.05em;
    background: linear-gradient(120deg, var(--brand), #db2777);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-page h1 { margin: 12px 0 8px; font-size: 21px; font-weight: 700; }
.error-page p { font-size: 13px; }
.error-page .btn { margin-top: 20px; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1000px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .admin-shell { flex-direction: column; }
    .sidebar {
        position: static;
        width: auto;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 12px 16px;
        overflow-x: auto;
    }
    .sidebar .brand-admin { flex: 0 0 auto; }
    .side-nav { flex-direction: row; margin: 0; gap: 2px; }
    .side-link { padding: 8px 10px; white-space: nowrap; }
    .side-foot {
        margin: 0 0 0 auto;
        padding: 0;
        border: 0;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    .side-ext { display: none; }
    .admin-top { position: static; height: 56px; padding: 0 18px; }
    .admin-content { padding: 18px 18px 44px; }
}

@media (max-width: 720px) {
    .wrap { padding: 0 16px; }
    .main { padding: 24px 0 48px; }
    .head-inner { height: 58px; }
    .head-nav { gap: 12px; }
    .hero { padding: 34px 0 18px; }
    .hero h1 { margin-top: 16px; }
    .hero-sub { font-size: 14px; }
    .code-box { padding: 7px; gap: 6px; }
    .code-box input { height: 42px; font-size: 14px; letter-spacing: 1px; }
    .code-box .btn { padding: 0 14px; font-size: 13px; }
    .steps { grid-template-columns: 1fr; margin-top: 34px; gap: 12px; }
    .panel { padding: 16px; }
    .card-strip { gap: 14px; padding: 14px 16px; }
    .cs-divider { display: none; }
    .cs-item { flex: 1 1 40%; }
    .cs-actions { width: 100%; margin-left: 0; }
    .file-grid { grid-template-columns: 1fr; }
    .section-head { align-items: flex-start; }
    .search-mini input { width: 100%; }
    .section-head .search-mini { width: 100%; }
    .action-bar { bottom: 8px; padding: 10px 12px; }
    .detail-grid { grid-template-columns: 1fr; gap: 14px; }
    .admin-content { padding: 16px 14px 40px; }
    .table th, .table td { padding: 10px; }
    .login-card { padding: 28px 22px 22px; }
}

@media (max-width: 520px) {
    .stat-grid { grid-template-columns: 1fr; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .code-box { flex-wrap: wrap; }
    .code-box input { flex-basis: calc(100% - 34px); }
    .code-box .btn { width: 100%; }
    .hero-note { gap: 10px 16px; }
    .panel-head-row { align-items: flex-start; }
    .head-tools { width: 100%; }
    .filter-form { width: 100%; }
    .filter-form .search-mini { flex: 1 1 auto; }
    .filter-form .search-mini input { width: 100%; }
    .admin-chip span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
