/* 管理后台：沿用 base.css 的纸墨变量，只补控制台需要的排布 */
.adm-main { padding: 22px 18px 60px }

/* ---------- 登录 ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 120;
  background: radial-gradient(120% 90% at 50% 0%, var(--paper-2), var(--paper)) }
.gate-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 30px 26px; display: grid; gap: 14px; text-align: center }
.gate-card .seal { width: 46px; height: 46px; margin: 0 auto; border-radius: 11px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-family: var(--serif); font-size: 22px }
.gate-card h1 { font-family: var(--serif); font-size: 20px; font-weight: 400; margin: 0; letter-spacing: .5px }
.gate-card .note { text-align: left; line-height: 1.8 }
.gate-card code { background: var(--paper-2); padding: 1px 6px; border-radius: 4px }
.center { text-align: center }
.btn.wide { width: 100%; justify-content: center; padding: 11px }

/* ---------- 面板 ---------- */
.panel { margin-bottom: 30px }
.panel-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line) }
.panel-h.sub { margin-top: 34px }
.panel-h h2 { font-family: var(--serif); font-size: 20px; font-weight: 400; margin: 0; letter-spacing: .5px }
.bar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.bar-tools .spacer { flex: 1 }
.panel > .note { margin: 0 0 16px }

/* ---------- 行 ---------- */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px }
.row { display: flex; align-items: center; gap: 13px; padding: 11px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); transition: box-shadow .18s, border-color .18s }
.row:hover { box-shadow: var(--shadow); border-color: var(--line) }
.row .thumb { width: 40px; aspect-ratio: 2/3; border-radius: 3px; object-fit: cover; background: var(--paper-2); flex: none }
.row .info { flex: 1; min-width: 0 }
.row .nm { font-family: var(--serif); font-size: 16px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap }
.row .nm .vip { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; font-family: var(--sans) }
.row .mt { font-size: 12px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end }
.row.off { opacity: .58 }
.row .flag { font-size: 11px; color: var(--teal); border: 1px solid currentColor; padding: 0 6px; border-radius: 999px }
.btn.danger { color: #a63a2a }
.btn.danger:hover { background: rgba(166, 58, 42, .1); border-color: currentColor }
/* 窄屏：操作按钮换到单独一行，标题与说明不被挤成多行 */
@media (max-width: 620px) {
  .row { flex-wrap: wrap; gap: 6px 12px }
  .row .info { flex: 1 1 190px }
  .row .acts { flex-basis: 100%; justify-content: flex-start }
  .row .mt { white-space: normal }
}

/* 分类行 */
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 46px 92px; gap: 10px; align-items: end; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r) }
.cat-row .f-row { gap: 4px }
.cat-row input[type=color] { width: 100%; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--card) }
.cat-row .cnt { font-size: 12px; color: var(--ink-3); align-self: center }
@media (max-width: 720px) { .cat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cat-row .acts2 { grid-column: 1 / -1 } }

/* ---------- 上传 ---------- */
.up-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.up-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; align-content: start }
.up-box.wide { grid-column: 1 / -1 }
.up-box h3 { font-family: var(--serif); font-size: 16px; font-weight: 400; margin: 0; display: flex; gap: 8px; align-items: baseline }
@media (max-width: 820px) { .up-grid { grid-template-columns: 1fr } }
.drop { display: block; border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--paper-2);
  padding: 4px; cursor: pointer; transition: .18s }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft) }
.drop-in { display: grid; gap: 4px; text-align: center; padding: 20px 10px; color: var(--ink-2); font-size: 13px }
.drop-in b { font-size: 14px; color: var(--ink) }
.drop-in small { color: var(--ink-3); word-break: break-all }
.cover-pv { width: 84px; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2) }
.cover-pv img { width: 100%; height: 100%; object-fit: cover }
.ch-list { display: grid; gap: 6px; max-height: 460px; overflow: auto; padding-right: 6px }
.ch-item { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line-2);
  border-radius: var(--r-s); background: var(--paper-2); font-size: 13px }
.ch-item .i { color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 26px }
.ch-item .t { flex: 1; font-family: var(--serif); font-size: 14.5px }
.ch-item .w { color: var(--ink-3); font-size: 11.5px }
.ch-item.lv1 { background: var(--accent-soft); border-color: transparent }
.ch-item.lv1 .t { color: var(--accent) }

/* ---------- 弹层 ---------- */
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%); z-index: 130;
  width: min(560px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s }
.modal.lg { width: min(1000px, 96vw) }
.modal.on { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line) }
.modal-h h3 { font-family: var(--serif); font-size: 17px; font-weight: 400; margin: 0; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.modal-b { padding: 16px; overflow: auto }
.modal-f { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line) }
.modal-f .spacer { flex: 1 }
.chap-body { display: grid; grid-template-columns: 260px 1fr; gap: 16px; padding: 0 }
.chap-side { overflow: auto; max-height: 74vh; padding: 12px; border-right: 1px solid var(--line) }
.chap-edit { padding: 16px; overflow: auto; max-height: 74vh; display: grid; gap: 12px; align-content: start }
textarea.tf.body { min-height: 340px; font-family: var(--serif); font-size: 15px; line-height: 1.8 }
@media (max-width: 720px) {
  .chap-body { grid-template-columns: 1fr }
  .chap-side { max-height: 22vh; border-right: none; border-bottom: 1px solid var(--line) }
  textarea.tf.body { min-height: 240px }
}
.side-item { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: transparent;
  border-radius: var(--r-s); cursor: pointer; font-size: 13px; color: var(--ink-2); font-family: var(--serif) }
.side-item:hover { background: var(--paper-2) }
.side-item.on { background: var(--accent-soft); color: var(--accent) }
.side-item .n { float: right; font-family: var(--sans); font-size: 11px; color: var(--ink-3) }

/* 顶栏在窄屏折行 */
@media (max-width: 900px) {
  .topbar-in { height: auto; padding: 9px 0; flex-wrap: wrap }
  #admTabs { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none }
  #admTabs::-webkit-scrollbar { display: none }
}
.tips { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; line-height: 1.9 }
.tips code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; font-size: 12px }

/* 未导出快照的提醒条 */
.sync-warn {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 11px 14px; border-radius: 10px;
  background: #fdf0d8; border: 1px solid #e2c48a; color: #6a4b12; font-size: 13.5px;
}
[data-theme="dark"] .sync-warn { background: #3a2f1c; border-color: #6b5528; color: #f0d9a8 }
.sync-warn .dot {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  background: #b3701a; color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.sync-warn .btn { margin-left: auto }

/* 直存状态徽标 */
.sv-chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: #ece5d7; color: #6a6355; border: 1px solid var(--line); vertical-align: 2px;
}
.sv-chip.on { background: #dff0e2; color: #245c33; border-color: #a9d4b4 }
.sv-chip.off { background: #fbe6e2; color: #8a3325; border-color: #e5b4ab }
.sv-chip.mini { margin-right: 8px; vertical-align: 0 }
[data-theme="dark"] .sv-chip { background: #2c2c31; color: #a9a49b; border-color: #3d3d44 }
[data-theme="dark"] .sv-chip.on { background: #1e3527; color: #9fd7b0; border-color: #2f5b3f }
[data-theme="dark"] .sv-chip.off { background: #3a2422; color: #eaa79c; border-color: #5e3833 }
