:root {
  --primary: #c1442e;
  --primary-dark: #a5371f;
  --primary-soft: #fdf0ed;
  --gold: #c99a3f;
  --ink: #1f2430;
  --ink-2: #4b5262;
  --ink-3: #858c9c;
  --line: #e6e8ee;
  --bg: #f4f5f8;
  --card: #ffffff;
  --ok: #1f9d55;
  --ok-soft: #e8f7ee;
  --warn: #c47f17;
  --warn-soft: #fdf5e3;
  --danger: #d14040;
  --danger-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 16px rgba(31, 36, 48, .06);
  --sidebar-w: 210px;
}

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

html, body { height: 100%; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

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

.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, #f6d9d2 0%, transparent 60%),
    linear-gradient(160deg, #2a1a17 0%, #4a2620 55%, #6b342a 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.login-card .logo {
  width: 54px; height: 54px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--primary), #e0705a);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(193, 68, 46, .35);
}

.login-card h1 {
  font-size: 20px;
  text-align: center;
  letter-spacing: .5px;
}

.login-card .sub {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  margin: 6px 0 24px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 7px;
  font-weight: 500;
}

.field input[type=text],
.field input[type=password],
.field input[type=number],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }

.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd3de; background: #fafbfd; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #187f45; border-color: #187f45; color: #fff; }

.btn-danger { color: var(--danger); border-color: #f0c9c9; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.btn-block { width: 100%; padding: 11px; font-size: 15px; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

.login-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f3d0d0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #1c212c;
  color: #aab2c4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 20px 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .5px;
  border-bottom: 1px solid #2b3240;
}
.brand span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #6f7a90;
  letter-spacing: 2px;
  margin-top: 4px;
}

.sidebar nav { padding: 12px 10px; flex: 1; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #aab2c4;
  font-size: 14px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.sidebar nav a:hover { background: #262d3b; color: #e8ebf2; }
.sidebar nav a.active { background: var(--primary); color: #fff; font-weight: 500; }
.sidebar nav a .ico { font-size: 15px; width: 18px; text-align: center; }

.sidebar nav a .badge {
  margin-left: auto;
  background: #e0503a;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  padding: 1px 7px;
  border-radius: 9px;
  font-weight: 600;
}
.sidebar nav a.active .badge { background: rgba(255, 255, 255, .28); }
.sidebar nav a .badge.zero { display: none; }

.side-foot {
  padding: 14px 20px;
  border-top: 1px solid #2b3240;
  font-size: 12px;
  color: #5f6a7e;
  line-height: 1.7;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.top-actions { display: flex; gap: 8px; }

.content { padding: 20px 24px 48px; }

.notice-bar {
  margin: 0 24px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.notice-bar.warn { background: var(--warn-soft); color: #8a5a0b; border: 1px solid #f0dfb8; }
.notice-bar.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3d0d0; }
.notice-bar .close { margin-left: auto; cursor: pointer; opacity: .6; font-size: 16px; }
.notice-bar .close:hover { opacity: 1; }

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

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

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 1px solid #eef0f4;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute;
  right: -18px; top: -18px;
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .7;
}
.stat .k { font-size: 12px; color: var(--ink-3); position: relative; z-index: 1; }
.stat .v {
  font-size: 27px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -.5px;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}
.stat.primary .v { color: var(--primary); }
.stat.warn .v { color: var(--warn); }
.stat.ok .v { color: var(--ok); }
.stat.danger .v { color: var(--danger); }
.stat.warn::after { background: var(--warn-soft); }
.stat.ok::after { background: var(--ok-soft); }
.stat.danger::after { background: var(--danger-soft); }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #eef0f4;
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

/* ---------------- 筛选 ---------------- */

.tabs { display: flex; gap: 4px; background: #eef0f4; padding: 3px; border-radius: 8px; }
.tabs button {
  padding: 6px 13px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  transition: all .15s;
  display: flex; align-items: center; gap: 5px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tabs button .n {
  font-size: 11px;
  background: #dfe2e9;
  color: var(--ink-2);
  padding: 0 5px;
  border-radius: 8px;
  font-weight: 500;
}
.tabs button.active .n { background: var(--primary-soft); color: var(--primary); }

.search-box { position: relative; }
.search-box input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
  width: 210px;
  outline: none;
  transition: all .15s;
}
.search-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box::before {
  content: '🔍';
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: .5;
  pointer-events: none;
}

select.mini {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfd;
  outline: none;
  cursor: pointer;
}
select.mini:focus { border-color: var(--primary); }

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

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

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

table.data th {
  text-align: left;
  padding: 11px 14px;
  background: #fafbfd;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f2f6;
  vertical-align: middle;
}

table.data tbody tr:hover { background: #fbfcfe; }
table.data tbody tr.star-row { background: #fffdf6; }
table.data tbody tr.star-row:hover { background: #fffaf0; }

.col-check { width: 38px; }
.col-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

.thumb-cell { display: flex; gap: 7px; align-items: center; }
.thumb {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef0f4;
  cursor: pointer;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.thumb.vid {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(140deg, #2c3342, #4a5468);
  color: #fff;
  border-color: transparent;
}
.thumb-more {
  font-size: 11px;
  color: var(--ink-3);
  background: #eef0f4;
  border-radius: 6px;
  padding: 2px 6px;
}

.who .nm { font-weight: 600; font-size: 14px; }
.who .tt { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.cell-intro {
  max-width: 300px;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.rejected { background: var(--danger-soft); color: var(--danger); }
.pill.cat { background: #eef0f4; color: var(--ink-2); }
.pill.star { background: #fdf5e3; color: var(--gold); }

.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
}
.empty .big { font-size: 42px; margin-bottom: 12px; opacity: .35; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
  flex-wrap: wrap;
  gap: 10px;
}
.pager .pages { display: flex; gap: 5px; align-items: center; }
.pager .pages button {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 13px;
}
.pager .pages button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager .pages button.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pages button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- 批量条 ---------------- */

.batchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--primary-soft);
  border-bottom: 1px solid #f5ddd6;
  font-size: 13px;
  flex-wrap: wrap;
}
.batchbar .cnt { color: var(--primary); font-weight: 600; }

/* ---------------- 弹窗 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-card.wide { max-width: 900px; }
@keyframes pop { from { transform: scale(.95) translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .x {
  border: none; background: transparent;
  font-size: 20px; color: var(--ink-3);
  width: 30px; height: 30px; border-radius: 7px;
  line-height: 1;
}
.modal-head .x:hover { background: #f0f2f6; color: var(--ink); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  background: #fafbfd;
  border-radius: 0 0 14px 14px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

/* 预览 */
.preview-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.preview-media img, .preview-media video {
  width: 100%; height: 150px; object-fit: cover;
  border-radius: 9px; background: #eef0f4; border: 1px solid var(--line);
}
.preview-meta { display: grid; grid-template-columns: 84px 1fr; gap: 9px 14px; font-size: 14px; line-height: 1.65; }
.preview-meta .k { color: var(--ink-3); font-size: 13px; }
.preview-meta .v { word-break: break-word; white-space: pre-wrap; }

/* 分类标签编辑 */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef0f4;
  border-radius: 20px;
  padding: 5px 6px 5px 13px;
  font-size: 13px;
}
.chip button {
  border: none; background: #dfe2e9; color: var(--ink-2);
  width: 19px; height: 19px; border-radius: 50%;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.chip button:hover { background: var(--danger); color: #fff; }

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #f0f2f6;
}
.switch-row:last-child { border-bottom: none; }
.switch-row .txt strong { display: block; font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.switch-row .txt span { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.switch { position: relative; width: 44px; height: 25px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #cfd3de;
  border-radius: 25px; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute;
  width: 19px; height: 19px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(19px); }

/* toast */
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #232936;
  color: #fff;
  padding: 11px 20px;
  border-radius: 9px;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  animation: drop .2s ease;
  max-width: 80vw;
}
@keyframes drop { from { transform: translate(-50%, -14px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }
.toast.ok { background: #1f7a46; }
.toast.err { background: #b93b3b; }

.loading { padding: 48px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* 详情里的小信息行 */
.kv-list { display: flex; flex-direction: column; gap: 2px; }
.kv-list .row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f0f2f6; font-size: 13px;
}
.kv-list .row:last-child { border-bottom: none; }
.kv-list .row .k { color: var(--ink-3); width: 92px; flex: 0 0 auto; }
.kv-list .row .v { color: var(--ink); word-break: break-all; }

.tip {
  background: #f7f9fc;
  border: 1px solid #e6ebf3;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.75;
}
.tip code {
  background: #eef2f8;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: var(--primary);
}

/* 响应式 */
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border: none; padding: 14px 16px; white-space: nowrap; }
  .brand span { display: none; }
  .sidebar nav { display: flex; padding: 8px; flex: none; }
  .sidebar nav a { white-space: nowrap; margin: 0 3px 0 0; padding: 8px 12px; }
  .sidebar nav a .txt { display: none; }
  .side-foot { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .search-box input { width: 150px; }
}
