/* 拼图工坊 · 后台管理样式 */
:root {
  --ink: #14161c; --ink-2: #3b4150; --muted: #7b8294; --line: #e9eaf1;
  --bg: #f6f7fb; --card: #fff; --brand: #ff5a36; --brand-2: #ff2d55;
  --violet: #6a5cff; --ok: #12a76b; --warn: #d98a00; --danger: #d33;
  --radius: 14px; --shadow: 0 8px 26px rgba(20,22,28,.06);
}
* { box-sizing: border-box; }
body.adm-body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.adm-shell { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.adm-side {
  width: 216px; flex: 0 0 216px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
}
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.adm-logo svg { width: 30px; height: 30px; display: block; }
.adm-brand strong { display: block; font-size: 14.5px; letter-spacing: .2px; }
.adm-brand em { font-style: normal; font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.adm-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.adm-nav-a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; color: var(--ink-2); transition: background .15s ease, color .15s ease;
}
.adm-nav-a svg { color: #9aa1b3; }
.adm-nav-a:hover { background: #f5f6fa; }
.adm-nav-a.on { background: linear-gradient(135deg, #fff2ee, #fff7f4); color: var(--brand); font-weight: 700; }
.adm-nav-a.on svg { color: var(--brand); }
.adm-side-foot { margin-top: auto; padding: 14px 18px 22px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted); }
.adm-side-foot a:hover { color: var(--brand); }

/* ---------- 主区 ---------- */
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 28px 12px;
}
.adm-top h1 { margin: 0; font-size: 21px; letter-spacing: -.4px; }
.adm-top-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); }
.adm-user { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); }
.adm-user i {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--violet), var(--brand)); color: #fff; font-style: normal; font-size: 13px; font-weight: 700;
}
.adm-content { padding: 6px 28px 40px; }
.adm-foot { margin-top: auto; padding: 18px 28px 26px; color: #9aa1b3; font-size: 12px; }

.adm-flash {
  margin: 4px 28px 14px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: #eafaf2; color: #0d7a50; border: 1px solid #c9f0dd;
}
.adm-flash.err { background: #fff2f1; color: #b83228; border-color: #ffd6d2; }

/* ---------- 卡片 / 栅格 ---------- */
.adm-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.adm-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.adm-card .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.adm-card .v { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.adm-card .s { font-size: 12px; color: var(--muted); }
.adm-card .tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f3f4f9; color: var(--ink-2); }
.adm-card.brand .v { color: var(--brand); }
.adm-card.violet .v { color: var(--violet); }

.adm-grid2 { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; margin-top: 16px; align-items: start; }
.adm-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.adm-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.adm-panel-head h2 { margin: 0; font-size: 14.5px; }
.adm-panel-head .more { font-size: 12.5px; color: var(--brand); font-weight: 600; }
.adm-panel-body { padding: 14px 18px 18px; }

/* 7 日柱状图 */
.adm-chart { display: flex; align-items: flex-end; gap: 10px; height: 128px; padding: 6px 2px 0; }
.adm-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.adm-chart .bar i {
  display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #ffb9a5, var(--brand)); min-height: 4px;
}
.adm-chart .bar b { font-size: 11px; color: var(--muted); font-weight: 500; }
.adm-chart .bar em { font-style: normal; font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 10px 18px; background: #fafbfe; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.adm-table td { padding: 11px 18px; border-bottom: 1px solid #f2f3f8; vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table tr:hover td { background: #fdfdff; }
.adm-table .num { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.adm-table .muted { color: var(--muted); font-size: 12px; }
.adm-table .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f2f3f8; display: block; }
.adm-thumb-ph { width: 46px; height: 46px; border-radius: 8px; background: #f1f2f8; display: flex; align-items: center; justify-content: center; color: #a8aebe; font-size: 11px; }

/* 徽章 */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: #f1f2f8; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: #e9f9f1; color: #0d7a50; }
.badge.off { background: #f3f4f8; color: #8a90a1; }
.badge.hot { background: #fff1ec; color: var(--brand); }
.badge.admin { background: #f0edff; color: #5846e0; }

/* ---------- 按钮与表单 ---------- */
.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: all .15s ease;
}
.adm-btn:hover { border-color: #d5d8e4; background: #fafbff; }
.adm-btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(255,72,60,.22); }
.adm-btn.primary:hover { transform: translateY(-1px); }
.adm-btn.danger { color: var(--danger); background: #fff4f3; border-color: #ffd9d5; }
.adm-btn.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.adm-btn[disabled] { opacity: .5; pointer-events: none; }

.adm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.adm-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.adm-field.full { grid-column: 1 / -1; }
.adm-field > em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.adm-field span em { font-style: normal; color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.adm-field input[type=text], .adm-field input[type=number], .adm-field textarea, .adm-field select {
  height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fafbff; font-size: 13px;
}
.adm-field textarea { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.adm-field input:focus, .adm-field textarea:focus, .adm-field select:focus {
  outline: none; border-color: #ffc4b7; box-shadow: 0 0 0 3px rgba(255,90,54,.1); background: #fff;
}
.adm-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.adm-hint { font-size: 12px; color: var(--muted); grid-column: 1 / -1; }
.adm-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.adm-check input { accent-color: var(--brand); }

.adm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.adm-search { display: flex; gap: 8px; }
.adm-search input {
  width: 240px; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; font-size: 13px;
}
.adm-search input:focus { outline: none; border-color: #ffc4b7; box-shadow: 0 0 0 3px rgba(255,90,54,.1); }

/* 分页 */
.adm-pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 14px 18px; font-size: 12.5px; color: var(--muted); }
.adm-pager a, .adm-pager span.cur {
  min-width: 30px; height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--ink-2);
}
.adm-pager span.cur { background: #fff2ee; border-color: #ffd6cb; color: var(--brand); font-weight: 700; }

/* 空态 */
.adm-empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* 模板格预览 */
.adm-slot { display: flex; gap: 10px; align-items: flex-start; }
.adm-slot-prev { overflow: hidden;
  width: 92px; flex: 0 0 92px; background: #f5f6fb; border: 1px dashed #dfe2ec; border-radius: 8px;
  padding: 8px; display: flex; align-items: center; justify-content: center;
}
.adm-slot-prev svg { width: 100%; height: auto; display: block; }

/* 登录页 */
.adm-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 18px;
  background: radial-gradient(900px 500px at 12% 8%, #ffe6df 0%, transparent 60%), radial-gradient(800px 520px at 92% 92%, #e9e6ff 0%, transparent 62%), #f7f8fb;
}
.adm-login {
  width: 100%; max-width: 384px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px 26px; box-shadow: 0 26px 70px rgba(20,22,28,.12);
}
.adm-login .brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.adm-login .brandline svg { width: 30px; height: 30px; }
.adm-login .brandline b { font-size: 15px; }
.adm-login .brandline em { font-style: normal; font-size: 11px; color: var(--muted); display: block; letter-spacing: 1px; }
.adm-login h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.4px; }
.adm-login p.sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.adm-login form { display: flex; flex-direction: column; gap: 14px; }
.adm-login label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.adm-login input {
  height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fafbff; font-size: 14px;
}
.adm-login input:focus { outline: none; border-color: #ffc4b7; box-shadow: 0 0 0 3px rgba(255,90,54,.1); background: #fff; }
.adm-login .adm-btn { height: 44px; font-size: 14px; margin-top: 4px; }
.adm-login .foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.adm-login .foot a { color: var(--brand); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .adm-cards { grid-template-columns: repeat(2, 1fr); }
  .adm-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .adm-shell { flex-direction: column; }
  .adm-side { width: 100%; flex: none; height: auto; position: sticky; top: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .adm-brand { padding: 12px 14px 6px; }
  .adm-nav { flex-direction: row; overflow-x: auto; padding: 6px 10px 10px; scrollbar-width: none; }
  .adm-nav::-webkit-scrollbar { display: none; }
  .adm-nav-a { white-space: nowrap; padding: 8px 12px; }
  .adm-side-foot { display: none; }
  .adm-top { padding: 14px 16px 8px; flex-wrap: wrap; }
  .adm-content { padding: 4px 16px 30px; }
  .adm-flash { margin: 4px 16px 12px; }
  .adm-foot { padding: 14px 16px 22px; }
  .adm-form { grid-template-columns: 1fr; }
  .adm-table { font-size: 12.5px; }
  .adm-table th, .adm-table td { padding: 9px 12px; }
  .adm-table .hide-sm { display: none; }
  .adm-panel { overflow-x: auto; }
  .adm-table { min-width: 560px; }
}
@media (max-width: 560px) {
  .adm-cards { grid-template-columns: 1fr; }
  .adm-search input { width: 100%; }
  .adm-search { width: 100%; }
}


/* 概览左列与快捷操作 */
.adm-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.adm-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 18px 18px; }
.adm-quick-a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px;
  background: #fafbff; border: 1px solid var(--line); transition: all .15s ease; color: var(--ink-2);
}
.adm-quick-a:hover { background: #fff; border-color: #ffd3c7; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255,90,54,.08); }
.adm-quick-a svg { color: var(--brand); margin-bottom: 4px; }
.adm-quick-a b { font-size: 13px; }
.adm-quick-a span { font-size: 11px; color: var(--muted); }
@media (max-width: 820px) { .adm-quick { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .adm-quick { grid-template-columns: 1fr 1fr; } }

/* 后台登录验证码 */
.adm-login .cap-row { display: flex; align-items: center; gap: 8px; }
.adm-login .cap-row .cap-input { flex: 1; min-width: 0; height: 44px; letter-spacing: 3px; text-transform: uppercase; }
.adm-login .cap-row .cap-img { width: 132px; height: 46px; flex: 0 0 132px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; display: block; }
.adm-login .cap-row .cap-refresh { flex: 0 0 auto; border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 700; white-space: nowrap; }
@media (max-width: 420px) { .adm-login .cap-row .cap-img { width: 110px; flex-basis: 110px; } }
