/* ==========================================================================
   WcceWiki · 维护端样式（依赖 style.css 中的基础变量与按钮）
   ========================================================================== */

.admin-body { background-color: #f6f4ef; }

/* ---------- 口令门 ---------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px 60px;
}
.gate-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px 30px 26px;
  box-shadow: 0 32px 70px -46px rgba(22, 32, 58, .55);
}
.gate-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}
.gate-brand b {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.2;
}
.gate-brand small {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  margin-top: 1px;
}
.gate h1 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -.02em;
}
.gate-lede {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.gate form { display: flex; flex-direction: column; gap: 10px; }
.gate input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.gate input:focus {
  border-color: #b6c6dd;
  box-shadow: 0 0 0 4px rgba(27, 55, 99, .08);
}
.gate form .btn { width: 100%; height: 42px; }
.gate-error {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #b3261e;
}
.gate-error:empty { display: none; }
.gate-note {
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--faint);
}
.gate-note code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  background: #f3f0e9;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--ink-soft);
}
.gate-note a {
  color: var(--navy);
  text-decoration: none;
  border-bottom: 1px solid rgba(27, 55, 99, .25);
}
.gate-note a:hover { border-bottom-color: var(--navy); }
.gate-back {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.gate-back:hover { color: var(--navy); text-decoration: underline; }

/* ---------- 顶栏 ---------- */

.admin-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 254, 251, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.admin-top-inner {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.admin-brand-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
}
.admin-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid #efdfc6;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}
.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.draft-state {
  font-size: 11.5px;
  color: var(--muted);
  margin-right: 4px;
  white-space: nowrap;
}
.draft-state.is-dirty { color: var(--amber); }

.draft-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 10px 14px;
  font-size: 12px;
  color: #6d5a3a;
  background: #fdf8ee;
  border: 1px solid #eee0c8;
  border-radius: 10px;
}

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

.admin-shell {
  display: grid;
  grid-template-columns: 348px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-top: 20px;
  padding-bottom: 72px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(22, 32, 58, .03);
}

/* ---------- 左侧列表 ---------- */

.list-panel {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 98px);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 15px 10px;
}
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.panel-head h2 span {
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
  margin-left: 4px;
}

.list-tools { padding: 0 15px 11px; }
.list-tools input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.list-tools input:focus {
  border-color: #b6c6dd;
  box-shadow: 0 0 0 3px rgba(27, 55, 99, .07);
}
.list-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 7px;
}
.list-filters select {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-family: inherit;
  outline: none;
}

.entry-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--line-soft);
  padding: 6px 8px;
  min-height: 120px;
}
.entry-list::-webkit-scrollbar { width: 8px; }
.entry-list::-webkit-scrollbar-thumb { background: #e2ded3; border-radius: 4px; }

.entry-empty {
  padding: 30px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

.entry {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 9px 9px 11px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .13s, border-color .13s;
}
.entry:hover { background: #faf9f5; }
.entry.is-active {
  background: #f2f6fc;
  border-color: #dbe6f4;
}
.entry.is-active::before {
  content: "";
  position: absolute;
  left: -1px; top: 9px; bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--navy);
}
.entry:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }

.entry-main { flex: 1; min-width: 0; }
.entry-title {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta {
  margin-top: 2px;
  display: flex;
  gap: 6px;
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta .dot { color: #d8d3c7; }

.state {
  flex: none;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.state.on { color: #0e6b61; background: #eef9f6; border-color: #ccebe4; }
.state.off { color: #7b8497; background: #f2f1ed; border-color: #e4e1d8; }

.entry-acts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity .13s;
}
.entry:hover .entry-acts,
.entry:focus-within .entry-acts { opacity: 1; }
@media (hover: none) {
  .entry-acts { opacity: 1; }
}
.entry-acts button {
  width: 22px; height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #9aa2b4;
  cursor: pointer;
  padding: 0;
}
.entry-acts button:hover { background: #eeeae0; color: var(--ink); }
.entry-acts button.is-danger:hover { background: #fbeceb; color: #b3261e; }

.list-foot {
  padding: 9px 15px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--faint);
}
.list-foot b { color: var(--ink-soft); font-weight: 600; }

/* ---------- 右侧主区 ---------- */

.main-panel { padding: 0 22px 24px; min-width: 0; }

.tabs {
  display: flex;
  gap: 2px;
  margin: 0 -22px 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  border: 0;
  background: none;
  padding: 15px 12px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--navy); }
.tab.is-on::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
}
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.form-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.01em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px 14px;
}
.field { min-width: 0; display: flex; flex-direction: column; }
.field.span2 { grid-column: 1 / -1; }
.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
}
.field label i { font-style: normal; color: #b3261e; margin-left: 2px; }
.field label small {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--faint);
}
.field .counter {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea {
  height: auto;
  min-height: 62px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.6;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #b6c6dd;
  box-shadow: 0 0 0 3px rgba(27, 55, 99, .075);
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: #e3b4b0;
  background: #fffafa;
}
.field-err {
  font-size: 11px;
  color: #b3261e;
  margin-top: 4px;
  line-height: 1.5;
}
.field-err:empty { display: none; }

.icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-row input {
  flex: 1;
  width: auto;
  min-width: 0;
}
.icon-preview {
  width: 38px; height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf9f5;
  color: var(--muted);
  font-size: 11px;
}
.icon-preview img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 4px;
}
.icon-preview .emoji {
  font-size: 20px;
  line-height: 1;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  padding-top: 4px;
}
.check input { width: 15px; height: 15px; accent-color: var(--navy); }

.form-error {
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid #f0c9c5;
  border-radius: 9px;
  background: #fdf4f3;
  color: #a3231c;
  font-size: 12px;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.form-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.6;
}
.form-hint code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  background: #f3f0e9;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 4px;
}

/* ---------- 危险操作 ---------- */

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 14px 16px;
  border: 1px dashed #e3cfcb;
  border-radius: 12px;
  background: #fdfaf8;
}
.danger-zone b { font-size: 12.5px; color: #7d3a34; }
.danger-zone p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: #a08b87;
}
.btn-danger-ghost {
  background: #fff;
  border-color: #e6cbc7;
  color: #a3352c;
}
.btn-danger-ghost:hover { border-color: #d8a9a4; background: #fdf3f2; }

/* ---------- 分类管理 ---------- */

.cat-list {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}
.cat-row:last-child { border-bottom: 0; }
.cat-index {
  flex: none;
  width: 22px;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.cat-name {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-family: inherit;
  outline: none;
}
.cat-name:hover { border-color: var(--line-soft); background: #fff; }
.cat-name:focus { border-color: #b6c6dd; background: #fff; box-shadow: 0 0 0 3px rgba(27, 55, 99, .07); }
.cat-name:disabled { color: var(--muted); font-weight: 500; }
.cat-count {
  flex: none;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.cat-acts { display: flex; gap: 2px; flex: none; }
.cat-acts button {
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.cat-acts button:hover { background: #f2efe7; color: var(--ink); }
.cat-acts button:disabled { opacity: .35; cursor: default; }
.cat-acts button.is-danger:hover { background: #fbeceb; color: #b3261e; }
.cat-add {
  display: flex;
  gap: 8px;
}
.cat-add input {
  flex: 1;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.cat-add input:focus { border-color: #b6c6dd; box-shadow: 0 0 0 3px rgba(27, 55, 99, .07); }
.cat-add .btn { flex: none; height: 36px; }

/* ---------- 批量导入 ---------- */

.batch-text {
  width: 100%;
  min-height: 168px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  outline: none;
  resize: vertical;
  margin-top: 10px;
}
.batch-text:focus { border-color: #b6c6dd; box-shadow: 0 0 0 3px rgba(27, 55, 99, .07); }
.batch-actions { display: flex; gap: 8px; margin-top: 10px; }
.batch-result { margin-top: 12px; font-size: 12px; }
.batch-result:empty { display: none; }
.batch-summary {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid;
  line-height: 1.7;
}
.batch-summary.ok { background: #f2faf7; border-color: #cfe9e1; color: #0e6b61; }
.batch-summary.bad { background: #fdf5f4; border-color: #f0cfcb; color: #a3231c; }
.batch-summary ul { margin: 6px 0 0; padding-left: 18px; }
.batch-summary li { margin: 2px 0; }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  z-index: 90;
  max-width: min(90vw, 460px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #16203a;
  color: #f4f1e9;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 18px 40px -18px rgba(16, 29, 53, .65);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #8f2a22; }

/* ---------- 发布弹窗 ---------- */

.dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 90px -40px rgba(16, 29, 53, .7);
}
.dialog::backdrop { background: rgba(16, 29, 53, .45); backdrop-filter: blur(2px); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-close {
  width: 30px; height: 30px;
  border: 0;
  border-radius: 8px;
  background: #f1eee6;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { background: #e8e3d8; color: var(--ink); }
.dialog-body { padding: 12px 20px 4px; }
.dialog-body > p { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.publish-steps {
  counter-reset: step;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.publish-steps li {
  position: relative;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fcfbf7;
  font-size: 12.5px;
}
.publish-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 12px; top: 11px;
  width: 18px; height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.publish-steps b { display: block; margin-bottom: 2px; }
.publish-steps span { color: var(--muted); }
.publish-steps code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  background: #f1eee6;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 4px;
}
.dialog-note {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: #fdf8ee;
  border: 1px solid #eee0c8;
  color: #7a6644;
  font-size: 11.5px;
  line-height: 1.7;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  padding: 14px 20px 20px;
}

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

@media (max-width: 1060px) {
  .admin-shell { grid-template-columns: 1fr; }
  .list-panel {
    position: static;
    max-height: none;
  }
  .entry-list { max-height: 320px; }
}

@media (max-width: 720px) {
  .admin-top-inner {
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
  }
  .admin-top-actions { width: 100%; justify-content: flex-start; }
  .draft-state { width: 100%; margin: 0; order: 4; }
  .main-panel { padding: 0 15px 20px; }
  .tabs { margin: 0 -15px 16px; padding: 0 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: auto; }
  .gate-card { padding: 24px 22px 22px; }
  .danger-zone { align-items: flex-start; }
  .cat-row { flex-wrap: wrap; }
  .cat-name { flex: 1 1 120px; }
  .cat-acts { margin-left: auto; }
}
