/* ============================================================
   不断光 · 推荐码准入 · 共用样式 v4.7
   面向移动端，大字体、简洁、暖色（金 / 深桃红 / 明黄）
   ============================================================ */

:root {
    --bg: #f7f1e3;
    --card: #fffdf7;
    --text: #3d2c1e;
    --muted: #7a6a58;
    --line: #e6d8bf;
    --gold: #b8860b;
    --gold-2: #d4a017;
    --peach: #a63d57;
    --ok: #2f7d4f;
    --ok-bg: #eaf6ee;
    --err: #b03a2e;
    --err-bg: #fdeceb;
    --radius: 16px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    line-height: 1.65;
}

a { color: var(--peach); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    letter-spacing: .06em;
}

/* ---------- 顶栏 ---------- */
.adv-top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 253, 247, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.adv-brand { display: flex; align-items: baseline; gap: 8px; color: var(--text); }
.adv-brand:hover { text-decoration: none; }
.adv-brand-main { font-size: 1.08rem; font-weight: 700; }
.adv-brand-sub { font-size: .88rem; color: var(--gold); font-weight: 600; }

.adv-top-link {
    font-size: .95rem;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    white-space: nowrap;
}
.adv-top-link:hover { color: var(--text); text-decoration: none; }

/* ---------- 页面容器 ---------- */
.adv-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 18px 16px 40px;
}
.adv-page.narrow { max-width: 560px; }
.adv-page.wide { max-width: 1080px; }

.adv-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 18px;
    margin-bottom: 16px;
    box-shadow: 0 8px 26px rgba(120, 92, 46, .06);
}

.adv-h1 { font-size: 1.45rem; margin: 0 0 14px; }
.adv-h2 { font-size: 1.16rem; margin: 0 0 12px; }
.adv-muted { color: var(--muted); font-size: .95rem; margin: 8px 0; }
.adv-empty { color: var(--muted); text-align: center; padding: 18px 0; }

/* ---------- 提示 ---------- */
.adv-alert {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid transparent;
}
.adv-alert.err { background: var(--err-bg); color: var(--err); border-color: #f3c9c4; }
.adv-alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #c9e6d3; }

/* ---------- 主视觉 ---------- */
.adv-hero {
    text-align: center;
    padding: 26px 16px 22px;
    margin-bottom: 16px;
}
.adv-hero.compact { padding: 18px 16px 10px; }

.adv-hero-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fdf3d0;
    color: var(--gold);
    border: 1px solid #ecdca6;
}
.adv-hero.is-ok .adv-hero-icon { background: var(--ok-bg); color: var(--ok); border-color: #c9e6d3; }
.adv-hero.is-denied .adv-hero-icon { background: var(--err-bg); color: var(--err); border-color: #f3c9c4; }

.adv-hero h1 { font-size: 1.55rem; margin: 0 0 8px; }
.adv-hero-sub { color: var(--muted); font-size: 1rem; margin: 0 auto; max-width: 30em; }

.adv-hero-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    margin-top: 14px;
    font-size: .92rem;
}
.adv-hero-links a { color: var(--muted); text-decoration: underline; }

/* ---------- 账号信息 ---------- */
.adv-meta {
    display: grid;
    gap: 8px;
    margin: 16px 0;
    text-align: left;
    background: #fbf6ea;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
}
.adv-meta > div { display: flex; justify-content: space-between; gap: 12px; }
.adv-meta dt { color: var(--muted); font-size: .92rem; margin: 0; }
.adv-meta dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- 等级徽章 ---------- */
.tier {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.7;
    white-space: nowrap;
}
.tier-D { background: #fdf3d0; color: #8a6d1d; border: 1px solid #ecdca6; }
.tier-G { background: #fbeccd; color: #96610a; border: 1px solid #efd6a1; }
.tier-S { background: #eef1f4; color: #5b6570; border: 1px solid #d9dfe5; }
.tier-B { background: #f3ece0; color: #7a6a58; border: 1px solid #e6d8bf; }

/* ---------- 按钮 ---------- */
.adv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.adv-btn:hover { text-decoration: none; transform: translateY(-1px); }
.adv-btn:active { transform: translateY(0); }
.adv-btn:focus-visible { outline: 3px solid rgba(184, 134, 11, .35); outline-offset: 2px; }

.adv-btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: #fff;
    box-shadow: 0 6px 18px rgba(184, 134, 11, .25);
}
.adv-btn-primary:hover { background: linear-gradient(135deg, #a87a09, #c49312); }

.adv-btn-secondary {
    background: #fbf6ea;
    color: var(--text);
    border-color: var(--line);
}
.adv-btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--line);
}
.adv-btn-lg { width: 100%; min-height: 54px; font-size: 1.12rem; margin-top: 16px; }
.adv-btn-sm { min-height: 34px; padding: 4px 12px; font-size: .85rem; border-radius: 8px; }
.adv-btn:disabled, .adv-btn.is-disabled { opacity: .55; pointer-events: none; box-shadow: none; }

.adv-divider { height: 1px; background: var(--line); margin: 20px 0; }

/* ---------- 表单 ---------- */
.adv-form { margin: 0; }
.adv-label {
    display: block;
    margin: 14px 0 6px;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
}
.adv-input {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 1.08rem;
    font-family: inherit;
    outline: none;
}
.adv-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184, 134, 11, .14);
}
select.adv-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 38px; }

.adv-hint { color: var(--muted); font-size: .82rem; line-height: 1.55; margin: 6px 0 0; }
.adv-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.adv-pre { overflow-x: auto; background: #faf7f0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .8rem; line-height: 1.65; white-space: pre-wrap; }

/* “记住我”开关（v4.0） */
.adv-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 4px;
    font-size: .95rem;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.adv-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex: none;
    accent-color: var(--gold);
    cursor: pointer;
}

.adv-inline-form { margin: 12px 0; }

/* ---------- 推荐码列表 ---------- */
.adv-code-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.adv-code-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}
.adv-code-item.is-disabled, .adv-code-item.is-expired, .adv-code-item.is-exhausted { opacity: .62; }

.adv-code-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.adv-code-text { font-size: 1.18rem; font-weight: 700; letter-spacing: .08em; color: var(--peach); word-break: break-all; }
.adv-copy {
    flex: none;
    border: 1px solid var(--line);
    background: #fbf6ea;
    color: var(--muted);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: .85rem;
    cursor: pointer;
}
.adv-copy:hover { color: var(--text); }

.adv-code-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 8px;
    color: var(--muted);
    font-size: .82rem;
}

.state-active { color: var(--ok); font-weight: 700; }
.state-disabled, .state-expired, .state-exhausted { color: var(--err); font-weight: 700; }

/* ---------- 步骤 / 说明 ---------- */
.adv-note { padding: 4px 4px 0; }
.adv-steps { margin: 10px 0; padding-left: 1.25em; color: var(--muted); font-size: .95rem; }
.adv-steps li { margin: 8px 0; }
.adv-steps-lg { font-size: 1.02rem; color: var(--text); line-height: 1.8; }

/* ---------- 课程列表 ---------- */
.adv-course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.adv-course-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.adv-course-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.adv-course-name { font-size: 1.08rem; font-weight: 700; }
.adv-course-badge {
    font-size: .78rem;
    color: var(--gold);
    background: #fdf3d0;
    border: 1px solid #ecdca6;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}
.adv-course-desc { color: var(--muted); font-size: .94rem; margin: 8px 0 14px; }
.adv-course-item .adv-btn { width: 100%; }

/* ---------- 后台 ---------- */
.adv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.adv-stat {
    background: #fbf6ea;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.adv-stat-num { display: block; font-size: 1.7rem; font-weight: 800; color: var(--peach); line-height: 1.2; }
.adv-stat-label { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }

.adv-tier-stats { display: grid; gap: 8px; }
.adv-tier-stat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    font-size: .9rem;
    color: var(--muted);
}

.admin-form .adv-btn { margin-top: 16px; }
.adv-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.adv-form-grid.two { grid-template-columns: 1fr 1fr; }

.adv-filter {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}
.adv-filter .adv-input { min-height: 44px; font-size: .95rem; }

.adv-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.adv-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 720px; }
.adv-table th {
    text-align: left;
    padding: 10px 12px;
    background: #fbf6ea;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}
.adv-table td { padding: 10px 12px; border-bottom: 1px solid #f0e7d6; vertical-align: middle; }
.adv-table tr:last-child td { border-bottom: 0; }
.adv-row-form { margin: 0; }

.adv-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

/* ---------- 页脚 ---------- */
.adv-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    color: var(--muted);
    font-size: .8rem;
    padding: 18px 8px 0;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
    .adv-page.wide { max-width: 100%; padding-left: 12px; padding-right: 12px; }
    .adv-filter { grid-template-columns: 1fr 1fr; }
    .adv-filter .adv-input:first-child { grid-column: 1 / -1; }
    .adv-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .adv-stat { padding: 10px 6px; }
    .adv-stat-num { font-size: 1.3rem; }
    .adv-form-grid, .adv-form-grid.two { grid-template-columns: 1fr; }
    .adv-hero h1 { font-size: 1.35rem; }
}

@media (max-width: 420px) {
    html { font-size: 17px; }
    .adv-top { padding: 12px 12px; }
    .adv-brand-sub { display: none; }
    .adv-card { padding: 16px 14px; }
    .adv-stats { grid-template-columns: 1fr; }
    .adv-stat { display: flex; align-items: baseline; justify-content: space-between; text-align: left; }
    .adv-stat-label { margin-top: 0; }
}

/* ---------- v4.1 名单生成 / 批次页 ---------- */
.adv-textarea {
    display: block;
    width: 100%;
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
    font-family: inherit;
}

.adv-h3 {
    margin: 26px 0 10px;
    font-size: 1.05rem;
    color: var(--adv-ink, #2f2a21);
}

.adv-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid #e6d9bf;
    border-radius: 10px;
    background: #fdf8ec;
    font-size: .95rem;
}

.adv-check input { margin-top: 4px; }

.adv-btn-sm { padding: 6px 10px; font-size: .85rem; }

.adv-btn-danger {
    background: #a33a2a;
    border-color: #a33a2a;
    color: #fff;
}

.adv-btn-danger:hover { background: #8d2f22; border-color: #8d2f22; }

.adv-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #6b6355;
}

.adv-batch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.adv-batch-manage {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.adv-batch-manage form { margin: 0; }

.adv-batch-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
}

/* v4.3 批次卡片：移动优先，单列纵向；名字作标题，码大字，其余信息次要 */
.adv-batch-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid #e4d9c3;
    border-radius: 14px;
    background: #fffdf8;
    break-inside: avoid;
    min-width: 0;
}

.adv-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.adv-card-title {
    flex: 1 1 100%;
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.3;
    color: #3b342a;
    word-break: break-word;
}

.adv-name-note {
    display: block;
    margin-top: 3px;
    font-size: .72rem;
    font-weight: 400;
    color: var(--muted);
}

.adv-card-state {
    margin-left: auto;
    font-size: .8rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1ece0;
    white-space: nowrap;
}

.adv-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px dashed #cdbfa4;
    border-radius: 10px;
    min-width: 0;
}

.adv-code-row .adv-code-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.5rem;
    letter-spacing: .1em;
    word-break: break-all;
}

.adv-code-row .adv-btn-sm,
.adv-card-actions .adv-btn,
.adv-card-actions .adv-copy {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.adv-card-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px 14px;
    margin: 0;
    font-size: .86rem;
}

.adv-card-meta div {
    display: flex;
    gap: 8px;
    line-height: 1.65;
    min-width: 0;
}

.adv-card-meta dt {
    flex: 0 0 4.5em;
    color: #8a8172;
}

.adv-card-meta dd {
    margin: 0;
    min-width: 0;
    word-break: break-all;
}

.adv-card-more {
    border-top: 1px solid #eee4d2;
    padding-top: 8px;
}

.adv-card-more summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #7a7264;
    font-size: .88rem;
}

.adv-batch-qr {
    width: 132px;
    height: 132px;
    margin: 8px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    color: #a99f8d;
    font-size: .8rem;
    text-align: center;
}

/* 微信长按识别要求页面上是 <img>，且不能被遮罩/禁用指针事件 */
.adv-qr-img {
    display: block;
    width: 132px;
    height: 132px;
    background: #ffffff;
    border-radius: 0;
    image-rendering: pixelated;
    user-select: auto;
    pointer-events: auto;
}

.adv-qr-canvas { width: 132px; height: auto; display: block; }

/* ============================================================
   v4.7 后台 TAB / 批量操作 / 课程扫描
   ============================================================ */

.adv-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.adv-tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}
.adv-tab:hover { text-decoration: none; color: var(--text); }
.adv-tab.is-active { background: var(--gold); border-color: var(--gold); color: #fff; }

.adv-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.adv-filter-drawer { display: grid; }

.adv-bulk-bar {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 8px 0 12px;
    background: #fff8e1;
    border: 1px solid #ecdca6;
    border-radius: 12px;
}

.adv-input-inline { min-height: 38px; padding: 4px 8px; font-size: .85rem; width: auto; }
.adv-bulk-bar .adv-check,
.adv-archive-bar .adv-check,
.adv-form .adv-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: .82rem;
    color: var(--muted);
}
.adv-check input { margin: 0; }

.adv-actions-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adv-row-form { display: inline-flex; margin: 0; }
.adv-block-reason { flex-basis: 100%; font-size: .68rem; color: #9a4b3b; }

.adv-auto-note {
    margin: 4px 0 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fbf6ea;
    border: 1px dashed var(--line);
    font-size: .82rem;
    color: var(--muted);
}

.adv-archive-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #fbf6ea;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.adv-h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.adv-selfcheck { max-width: 260px; font-size: .76rem; line-height: 1.5; }
.adv-url-cell { max-width: 220px; word-break: break-all; font-size: .78rem; }
.adv-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }

.adv-codes-table td,
.adv-codes-table th { vertical-align: middle; }
.adv-codes-table tbody tr { cursor: pointer; }

@media (max-width: 719px) {
    .adv-filter-drawer { display: none; }
    .adv-filter-drawer.is-open { display: grid; }
    .adv-tabs { margin-left: -4px; margin-right: -4px; }
    .adv-tab { padding: 8px 12px; }
}

@media print {
    .adv-tabs, .adv-filter-drawer, .adv-bulk-bar, .adv-row-actions, .adv-row-form { display: none !important; }
}


.adv-batch-card-body { flex: 1 1 auto; min-width: 0; }

.adv-share-url {
    margin: 6px 0 0;
    font-size: .75rem;
    color: #8a8172;
    word-break: break-all;
}

.adv-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: auto;
}

/* ≥560px：卡片次要信息两列；≥900px：卡片本身两列；≥1250px：三列 */
@media (min-width: 560px) {
    .adv-card-title { flex: 0 1 auto; margin-right: auto; }
    .adv-card-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
    .adv-batch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1250px) {
    .adv-batch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 管理页表格：窄屏时在容器内横向滚动，避免整页溢出 */
.adv-table-wrap {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.adv-table {
    width: 100%;
}

.adv-card { min-width: 0; }

@media print {
    .adv-top, .adv-no-print, .adv-copy, .adv-card-actions, .adv-footer, .adv-alert { display: none !important; }
    .adv-page { max-width: 100%; padding: 0; }
    .adv-hero { box-shadow: none; border: 0; padding-bottom: 8px; }
    .adv-card { box-shadow: none; border: 0; padding: 0; }
    .adv-batch-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .adv-batch-card { border: 1px solid #ccc; }
    body { background: #fff; }
}

/* v4.3 课程等级：不可用课程仍展示，但置灰并说明所需等级 */
.adv-course-item.is-locked { opacity: .78; }
.adv-course-item.is-locked .adv-btn { pointer-events: none; }
.adv-locked-tip { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: #f3efe4; color: #7a7264; line-height: 1.7; }
/* v4.3 分发进度时间线 */
.adv-timeline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: #7a7264; }
.adv-timeline span { padding: 3px 8px; border-radius: 999px; background: #f1ece0; white-space: nowrap; }
.adv-timeline span.is-done { background: #e7f1e3; color: #3f6b3a; }

/* ============================================================
   v4.7 推荐码列表：一行一码，纵向清单（取代多列卡片网格）
   - 宽屏：左侧名字/等级 | 中间推荐码 | 右侧操作
   - <560px：名字、码、操作各占一行，操作整宽换行
   ============================================================ */
.adv-code-list {
    border-top: 1px solid var(--line);
}

.adv-code-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px 16px;
    min-height: 64px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--line);
}

.adv-ci-ident {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-width: 0;
}

.adv-ci-name {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adv-ci-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.adv-ci-sub {
    flex-basis: 100%;
    margin: 0;
    font-size: .7rem;
    line-height: 1.3;
    color: var(--muted);
}

.adv-ci-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf8;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.adv-ci-code:hover,
.adv-ci-code:focus-visible {
    border-color: var(--gold-2);
    background: #fff8e4;
}

.adv-ci-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.adv-ci-form {
    display: inline-flex;
    margin: 0;
}

.adv-ci-reason {
    flex-basis: 100%;
    max-width: 160px;
    margin-left: auto;
    font-size: .68rem;
    line-height: 1.3;
    color: #9a4b3b;
    text-align: right;
}

@media (max-width: 559px) {
    .adv-code-item {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 14px 2px;
    }

    .adv-ci-name {
        flex-basis: 100%;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .adv-ci-code {
        width: 100%;
        padding: 12px 18px;
        font-size: 1.35rem;
        letter-spacing: .14em;
    }

    .adv-ci-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .adv-ci-actions .adv-btn-sm,
    .adv-ci-form {
        flex: 1 1 auto;
    }

    .adv-ci-form .adv-btn-sm {
        width: 100%;
    }

    .adv-ci-reason {
        max-width: none;
        flex-basis: 100%;
        margin-left: 0;
        text-align: left;
    }

    /* 筛选条在窄屏改为单列，避免控件被压扁 */
    .adv-filter {
        grid-template-columns: 1fr;
    }

    .adv-filter .adv-input:first-child {
        grid-column: auto;
    }
}
