/* =========================================================
   雪糕付费系统 · 后台样式（无第三方依赖）
   ========================================================= */

:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --ink: #1b2434;
    --ink-2: #3c4a61;
    --muted: #6b7a90;
    --line: #e5eaf2;
    --line-2: #eff3f9;
    --brand: #3b6ef6;
    --brand-dark: #2b56cc;
    --brand-soft: #eaf0ff;
    --dark: #101a2c;
    --dark-2: #17233a;
    --success: #0f9d58;
    --warn: #c97c12;
    --danger: #d63b3a;
    --info: #2f7fd1;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 26, 44, .06), 0 8px 24px rgba(16, 26, 44, .05);
}

* { box-sizing: border-box; }

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

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

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: .2px; }

/* ---------------- 布局 ---------------- */

.layout { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 232px;
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-2) 100%);
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #5b8bff, #3159d8);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(59, 110, 246, .35);
    flex: 0 0 auto;
}

.brand-text { min-width: 0; }
.brand-name { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; white-space: nowrap; }
.brand-sub { color: #7d8ca6; font-size: 11px; letter-spacing: 1px; }

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 12px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    margin-bottom: 4px;
    border-radius: 9px;
    color: #a9b6cb;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-item.is-active {
    background: rgba(59, 110, 246, .18);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(92, 138, 255, .35);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4b5b75;
    flex: 0 0 auto;
}

.nav-item.is-active .nav-dot { background: #6b96ff; box-shadow: 0 0 0 4px rgba(107, 150, 255, .18); }

.nav-label { flex: 1; }

.nav-caret { font-size: 11px; color: #6b7a92; }

.nav-toggle {
    width: 100%;
    background: none;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.nav-toggle:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-toggle.is-open .nav-caret { color: #9db8ff; }

.nav-sub {
    display: none;
    margin: -2px 0 6px 12px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, .1);
}

.nav-sub.is-open { display: block; }

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    color: #8f9db4;
    font-size: 13px;
    transition: background .15s, color .15s;
}

.nav-sub-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-sub-item.is-active {
    background: rgba(59, 110, 246, .14);
    color: #fff;
}

.nav-sub-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #4b5b75;
    flex: 0 0 auto;
}

.nav-sub-item.is-active .nav-sub-dot { background: #6b96ff; }

.nav-sub-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-sub-empty { padding: 6px 10px; font-size: 12px; color: #6b7a92; }

.nav-badge {
    background: #e0453f;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-foot {
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.who { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #dfe7f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex: 0 0 auto;
}

.who-text { min-width: 0; }
.who-name { color: #e7edf8; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { color: #7d8ca6; font-size: 11px; }

.logout {
    display: block;
    margin-top: 12px;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    color: #b7c3d6;
    font-size: 13px;
}
.logout:hover { background: rgba(224, 69, 63, .16); color: #ff9a96; }

.main {
    margin-left: 232px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title { font-size: 17px; color: var(--ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.chip {
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
}

.menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    width: 36px;
    height: 32px;
    cursor: pointer;
    color: var(--ink-2);
    font-size: 15px;
}

.content { padding: 22px 28px 40px; }

/* ---------------- 卡片 / 表单 ---------------- */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0;
    overflow: hidden;
}

.card-pad { padding: 20px 22px; }

.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line-2);
}

.card-head h2 { font-size: 15px; }
.card-head .muted { font-size: 12px; }
.card-head .spacer { flex: 1; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}
.page-head h2 { font-size: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.page-head .spacer { flex: 1; }

.toolbar, .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-2);
    background: #fbfcfe;
}

.toolbar .spacer, .filters .spacer { flex: 1; }

/* 无筛选项时（管理员端列表）只留右上角的新增按钮 */
.filters-plain { justify-content: flex-end; }

.input, select.input, textarea.input {
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

textarea.input { height: auto; padding: 10px 11px; line-height: 1.7; resize: vertical; }

.input:focus, select.input:focus, textarea.input:focus {
    border-color: #9db8ff;
    box-shadow: 0 0 0 3px rgba(59, 110, 246, .12);
}

.input-sm { height: 32px; font-size: 13px; }
.input-full { width: 100%; }
.filters .input { min-width: 132px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.btn:hover { background: #f5f7fc; border-color: #d8e0ee; color: var(--ink); }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(59, 110, 246, .22); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn-danger { background: #fdecec; border-color: #f6d2d1; color: var(--danger); }
.btn-danger:hover { background: #fbdcdb; border-color: #f2bcba; color: #b52e2d; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0f3f9; color: var(--ink); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

.link-btn {
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    color: var(--brand);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.link-btn:hover { color: var(--brand-dark); }
.link-danger { color: var(--danger); }
.link-danger:hover { color: #b52e2d; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
    padding: 22px;
}

.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .req { color: var(--danger); margin-left: 2px; }

.form-actions {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--line-2);
    background: #fbfcfe;
}

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    background: #fafbfe;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
    font-size: 12.5px;
    letter-spacing: .3px;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-2);
    vertical-align: middle;
}

.table tbody tr:hover td { background: #fafcff; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table .mono { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; font-size: 12.5px; color: var(--ink); }
.table .num { font-variant-numeric: tabular-nums; }
.table .strong { color: var(--ink); font-weight: 600; }

.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions form { margin: 0; }

.empty-state { padding: 56px 20px; text-align: center; }
.empty-state .ico { font-size: 26px; color: #c2ccdc; }
.empty-state p { color: var(--muted); margin: 10px 0 18px; }

/* ---------------- 徽章 / 提示 ---------------- */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #e7f7ee; color: #0b7d46; }
.badge-warn    { background: #fdf3e2; color: #a4650a; }
.badge-danger  { background: #fdecec; color: #b52e2d; }
.badge-info    { background: #eaf2fd; color: #2264ab; }
.badge-muted   { background: #f0f2f7; color: #6b7a90; }
.badge-brand   { background: var(--brand-soft); color: var(--brand-dark); }

.alert {
    padding: 11px 16px;
    border-radius: 9px;
    margin-bottom: 14px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-success { background: #e9f8f0; border-color: #c9eedd; color: #0b7d46; }
.alert-danger  { background: #fdecec; border-color: #f6d2d1; color: #b52e2d; }
.alert-warning { background: #fdf5e6; border-color: #f5e2bd; color: #9a6108; }
.alert-info    { background: #eaf2fd; border-color: #cfdefa; color: #2264ab; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------------- 统计卡片 ---------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    right: -28px;
    top: -28px;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: var(--brand-soft);
    opacity: .8;
}

.stat-label { font-size: 12.5px; color: var(--muted); letter-spacing: .3px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12px; color: var(--muted); margin-top: 6px; position: relative; z-index: 1; }
.stat-foot .up { color: var(--success); font-weight: 600; }

/* ---------------- 详情页 ---------------- */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}

.detail-item {
    padding: 14px 22px;
    border-bottom: 1px solid var(--line-2);
}

.detail-item .k { font-size: 12.5px; color: var(--muted); }
.detail-item .v { margin-top: 4px; color: var(--ink); font-size: 14px; word-break: break-all; }

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

.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------------- 分页 ---------------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-2);
    flex-wrap: wrap;
}

.pager-info { color: var(--muted); font-size: 12.5px; }
.pager-links { display: flex; gap: 6px; flex-wrap: wrap; }

.pager-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink-2);
    font-size: 12.5px;
}

.pager-btn:hover { border-color: #cfdbf0; background: #f5f8ff; color: var(--brand); }
.pager-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager-btn.is-disabled { color: #b7c1d1; background: #fafbfe; pointer-events: none; }
.pager-gap { color: var(--muted); padding: 0 2px; }

/* ---------------- 登录页 ---------------- */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 12% 8%, rgba(59, 110, 246, .16), transparent 70%),
        radial-gradient(700px 500px at 88% 92%, rgba(24, 160, 200, .12), transparent 70%),
        #101a2c;
}

.auth-card {
    width: 100%;
    max-width: 392px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(6, 12, 24, .42);
    padding: 34px 32px 30px;
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }

.auth-title { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.auth-sub { font-size: 12.5px; color: var(--muted); letter-spacing: .4px; margin-top: 2px; }

.auth-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.auth-field label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.auth-field input {
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus { border-color: #9db8ff; box-shadow: 0 0 0 3px rgba(59, 110, 246, .13); }

.auth-actions { margin-top: 22px; }
.auth-actions .btn { height: 42px; font-size: 14.5px; font-weight: 600; }

.auth-foot { margin-top: 20px; text-align: center; font-size: 12px; color: #9aa7bb; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .content { padding: 18px 16px 32px; }
    .topbar { padding: 0 16px; }
    .form-grid, .detail-grid, .split { grid-template-columns: minmax(0, 1fr); }
    .page-title { font-size: 15.5px; }
}

/* ---------------- 模板预览图 ---------------- */

.tpl-cell { display: flex; align-items: center; gap: 8px; }

.thumb {
    display: block;
    width: 150px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #e3e8ef;
    background: #f5f7fa;
    flex: 0 0 auto;
}

.thumb:hover { border-color: #9db8ff; }

.thumb-lg { width: 168px; height: 108px; border-radius: 8px; object-fit: cover; }

.thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 84px;
    font-size: 12px;
    color: #9aa7bb;
    font-weight: 400;
}

input[type="file"].input { padding: 8px 10px; background: #fff; cursor: pointer; }

/* ---------- 管理员端项目模板数据表 ---------- */
.stats-table thead th {
    text-align: center;
    background: #fafbfc;
    color: #1f2a3d;
    font-weight: 600;
    border-bottom: 1px solid #e9edf3;
}

.stats-table tbody td {
    text-align: center;
    padding: 16px 14px;
    color: #3a4557;
    border-bottom: 1px solid #f1f3f7;
}

.stats-table tbody tr:hover td { background: #fafcff; }

.stats-table .num {
    color: #00a870;
    font-weight: 600;
}

.stats-table .tpl-id { color: #8a94a6; }

.stats-table .tpl-link {
    color: #1f2a3d;
    font-weight: 600;
    text-decoration: none;
}

.stats-table .tpl-link:hover { color: #2b6cff; }

.stats-table .tpl-sub { margin-top: 3px; font-size: 12px; color: #9aa7bb; }

.stats-table .tpl-remark { color: #5b687d; }

.stats-table input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

.stats-table .promo { display: flex; align-items: center; justify-content: center; gap: 6px; }

.stats-table .promo-link {
    color: #2b6cff;
    font-size: 12.5px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.stats-table .promo-link:hover { text-decoration: underline; }

.stats-table .promo-copy {
    flex: none;
    height: 24px;
    padding: 0 8px;
    border: 1px solid #e2e8f2;
    border-radius: 6px;
    background: #fff;
    color: #5b687d;
    font-size: 12px;
    cursor: pointer;
}

.stats-table .promo-copy:hover { border-color: #2b6cff; color: #2b6cff; }

.stats-table .promo-copy.is-copied { border-color: #00a870; color: #00a870; }

.batch-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 22px 0;
}

.batch-bar form { display: flex; align-items: center; gap: 12px; margin: 0; }

.btn-danger:disabled { opacity: .55; cursor: not-allowed; }

form.inline { display: inline; margin: 0; }

/* ---------- 单选卡片（选择模板页面） ---------- */
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #e3e8ef;
    border-radius: 7px;
    background: #fff;
    color: #3a4557;
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.radio-item:hover { border-color: #b9cdfd; background: #fafcff; }

.radio-item input[type="radio"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #2b6cff;
    cursor: pointer;
}

.radio-item input[type="radio"]:checked + span { color: #2b6cff; font-weight: 600; }

.radio-item:has(input[type="radio"]:checked) { border-color: #2b6cff; background: #f5f8ff; }

/* 带缩略图的模板页面选项 */
.radio-card {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
    grid-column: span 1;
}

.radio-card input[type="radio"] { align-self: flex-start; }

.radio-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    background: #f5f7fa;
    border: 1px solid #eef1f5;
    overflow: hidden;
}

.radio-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.radio-thumb-empty {
    color: #b3bccb;
    font-size: 12px;
    font-weight: 400;
}

.radio-card .radio-name {
    font-size: 13px;
    color: #3a4557;
    line-height: 1.4;
    word-break: break-all;
}

.radio-card:has(input[type="radio"]:checked) .radio-name { color: #2b6cff; font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 24px;
    overflow-y: auto;
}

.modal.is-open { display: flex; }

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .45);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 760px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid #eef1f5;
}

.modal-head h3 {
    margin: 0;
    font-size: 15px;
    color: #1f2a3d;
}

.modal-head .modal-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #8a94a6;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.modal-head .modal-close:hover { background: #f3f5f9; color: #1f2a3d; }

.modal-body {
    padding: 18px 22px;
    max-height: 68vh;
    overflow-y: auto;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #eef1f5;
    background: #fafbfc;
}

.modal .form-grid { padding: 0; }

/* ---------- 管理员端项目模板卡片 ---------- */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 18px 22px 22px;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.tpl-card:hover { border-color: #b9cdfd; box-shadow: 0 4px 14px rgba(24, 54, 130, .08); }

.tpl-cover {
    aspect-ratio: 16 / 9;
    background: #f5f7fa;
    border-bottom: 1px solid #eef1f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tpl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tpl-cover-empty { font-size: 12px; color: #9aa7bb; }

.tpl-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 10px;
}

.tpl-name { font-size: 14px; font-weight: 600; color: #1f2a3d; }

.tpl-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tpl-actions { display: flex; gap: 8px; padding: 0 14px 14px; }

.tpl-actions .btn { flex: 1 1 0; text-align: center; }