/* ===== 全国人民合唱收集平台 · 后台样式 =====
   亮/暗主题通过 <html data-theme="light|dark"> 切换 */
:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #1f2937;
    --text-2: #6b7280;
    --text-3: #9ca3af;
    --border: #d1d5db;
    --input-bg: #ffffff;
    --soft: #f3f4f6;
    --hover-bg: #fafafa;
    --head-bg: #f9fafb;
    --shadow: rgba(0, 0, 0, 0.07);
    --shadow-strong: rgba(185, 28, 28, 0.15);
    --red-bg: #fef2f2;
    --red-border: #fecaca;
}
[data-theme="dark"] {
    --bg: #161b22;
    --card: #1f2735;
    --text: #e5e7eb;
    --text-2: #9ca3af;
    --text-3: #6b7280;
    --border: #374151;
    --input-bg: #11161d;
    --soft: #252d3d;
    --hover-bg: #232b3a;
    --head-bg: #252d3d;
    --shadow: rgba(0, 0, 0, 0.35);
    --shadow-strong: rgba(0, 0, 0, 0.45);
    --red-bg: #3f1d2a;
    --red-border: #7f1d1d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .25s, color .25s;
}

a { color: #b91c1c; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.topbar {
    background: linear-gradient(90deg, #7f1d1d, #b91c1c, #f59e0b);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    gap: 12px; flex-wrap: wrap;
}
.topbar .brand { font-size: 18px; font-weight: 700; }
.topbar .brand small { font-weight: 400; font-size: 12px; opacity: .8; margin-left: 8px; }
.topbar .nav { display: flex; align-items: center; flex-wrap: wrap; }
.topbar .nav a {
    color: #fff; margin-left: 16px; font-size: 14px; opacity: .9; white-space: nowrap;
}
.topbar .nav a:hover { opacity: 1; text-decoration: underline; }
.theme-btn {
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
    color: #fff; border-radius: 8px; padding: 3px 10px; font-size: 14px;
    cursor: pointer; line-height: 1.2; margin-left: 16px; transition: background .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.3); }

/* ---------- 主体容器 ---------- */
.wrap { max-width: 1080px; margin: 24px auto; padding: 0 20px 40px; }

/* ---------- 方块（卡片网格） ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 18px;
}
.card {
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 14px var(--shadow);
    transition: transform .18s, box-shadow .18s, background .25s;
    border-top: 6px solid #b91c1c;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px var(--shadow-strong); }
.card.closed { border-top-color: #9ca3af; opacity: .85; }
.card.publish { border-top-color: #059669; }

.card .cover {
    height: 92px;
    background: linear-gradient(135deg, #b91c1c, #f59e0b);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 42px; font-weight: 700;
}
.card .cover.thumb { background: var(--soft); color: var(--text-3); }
.card .body { padding: 14px 16px 16px; }
.card .body h3 { font-size: 16px; line-height: 1.4; min-height: 44px; margin-bottom: 10px; }
.card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-2); }
.card .num { font-size: 22px; font-weight: 700; color: #b91c1c; }
.card .actions { display: flex; gap: 8px; margin-top: 14px; }

.btn {
    display: inline-block; padding: 6px 12px; border-radius: 8px; font-size: 13px;
    border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
    transition: background .15s, border-color .2s, color .25s;
}
.btn:hover { background: var(--hover-bg); text-decoration: none; }
.btn-primary {
    background: linear-gradient(90deg, #b91c1c, #f59e0b); color: #fff; border: 0;
}
.btn-primary:hover { opacity: .92; box-shadow: 0 4px 10px rgba(185,28,28,.3); }
.btn-danger { background: var(--red-bg); color: #b91c1c; border-color: var(--red-border); }
.btn-danger:hover { background: var(--red-border); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.badge-open    { background: #d1fae5; color: #065f46; }
.badge-closed  { background: var(--soft); color: var(--text-2); }
.badge-publish { background: #fde68a; color: #92400e; }
.badge-expired { background: #f3e8ff; color: #6b21a8; }

/* ---------- 状态切换 ---------- */
.switch-form { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.switch-form select {
    flex: 1; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px;
    background: var(--input-bg); color: var(--text);
}

/* ---------- 页头 ---------- */
.page-head {
    display: flex; align-items: center; justify-content: space-between; margin-top: 22px; gap: 12px; flex-wrap: wrap;
}
.page-head h2 { font-size: 20px; }
.page-head .actions { display: flex; gap: 10px; }

/* ---------- 表格 ---------- */
.table-card { background: var(--card); border-radius: 14px; box-shadow: 0 4px 14px var(--shadow); overflow: hidden; margin-top: 18px; transition: background .25s; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-card th, .table-card td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-card th { background: var(--head-bg); color: #6b7280; font-weight: 600; }
[data-theme="dark"] .table-card th { color: var(--text-2); }
.table-card tr:last-child td { border-bottom: 0; }
.table-card tr:hover td { background: var(--hover-bg); }
.audio-pl { display: flex; align-items: center; gap: 8px; }
audio { height: 32px; }

/* ---------- 表单（新增/编辑征集） ---------- */
.form-card { background: var(--card); border-radius: 14px; box-shadow: 0 4px 14px var(--shadow); padding: 24px; margin-top: 18px; max-width: 640px; transition: background .25s; }
.form-card label { display: block; font-size: 13px; color: var(--text-2); margin: 14px 0 5px; }
.form-card input[type=text], .form-card input[type=datetime-local], .form-card textarea, .form-card select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
    background: var(--input-bg); color: var(--text); transition: border-color .2s, background .25s;
}
.form-card textarea { min-height: 90px; resize: vertical; }
.form-card input:focus, .form-card textarea:focus { outline: none; border-color: #b91c1c; }
.form-card .btns { margin-top: 22px; display: flex; gap: 10px; }
.form-card .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7f1d1d, #b91c1c, #f59e0b);
    padding: 20px;
}
.login-card {
    background: var(--card); border-radius: 16px; padding: 34px 34px 28px; width: 100%; max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    transition: background .25s;
}
.login-card h1 { font-size: 20px; color: #7f1d1d; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; font-size: 12px; color: var(--text-3); margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 5px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--input-bg); color: var(--text); }
.login-card input:focus { outline: none; border-color: #b91c1c; }
.alert-error { background: var(--red-bg); color: #b91c1c; border: 1px solid var(--red-border); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
[data-theme="dark"] .alert-success { background: #123524; color: #6ee7a0; border-color: #14532d; }
[data-theme="dark"] .alert-info    { background: #12233d; color: #93c5fd; border-color: #1e3a5f; }

.empty {
    text-align: center; padding: 60px 20px; color: var(--text-3); background: var(--card);
    border-radius: 14px; margin-top: 18px; box-shadow: 0 4px 14px var(--shadow); transition: background .25s;
}
.empty a { color: #b91c1c; font-weight: 700; }

/* 说明标签 */
.tag { font-size: 11px; color: var(--text-3); background: var(--soft); padding: 2px 8px; border-radius: 6px; margin-left: 6px; }

/* 存储设置页 */
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.st-opt { position: relative; cursor: pointer; }
.st-opt input { position: absolute; opacity: 0; }
.st-opt span {
    display: block; padding: 10px; text-align: center; border: 2px solid var(--border);
    border-radius: 10px; font-size: 13px; color: var(--text-2); transition: all .15s;
}
.st-opt input:checked + span { border-color: #b91c1c; background: var(--red-bg); color: #b91c1c; font-weight: 700; }
.st-field { display: none; margin-top: 4px; }
.st-field.on { display: block; }
.st-at { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-top: 4px; }
.st-active { background: #d1fae5; color: #065f46; }
.st-inactive { background: var(--soft); color: var(--text-3); }