/* 南京润钧官网 · 后台管理样式（与官网同色系：品牌蓝 #0f2db3） */
:root {
  --blue: #0f2db3;
  --blue-2: #2b59ff;
  --blue-soft: #eef2ff;
  --deep: #0a2778;
  --ink: #12192b;
  --ink-2: #4b5871;
  --line: #e3e8f2;
  --bg: #f5f7fc;
  --white: #fff;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 45, 179, .06), 0 8px 24px rgba(15, 45, 179, .06);
}

* { box-sizing: border-box; }

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

code { background: #eef1f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------------- 登录 ---------------- */
.login-layer {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a2778 0%, #0f2db3 45%, #2b59ff 100%);
  padding: 24px;
}
.login-box {
  width: 100%; max-width: 400px; background: var(--white); border-radius: 16px;
  padding: 32px; box-shadow: 0 24px 60px rgba(6, 16, 60, .35);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.lb-mark {
  width: 46px; height: 46px; border-radius: 11px; background: var(--blue);
  color: #fff; font-weight: 800; font-size: 24px; display: flex; align-items: center;
  justify-content: center; flex: none;
}
.login-brand h1 { font-size: 17px; margin: 0; letter-spacing: .3px; }
.login-brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }
.lb-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.lb-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none; transition: .2s;
}
.lb-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 45, 179, .1); }
.lb-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 6px; }
.lb-hint { font-size: 12px; color: var(--ink-2); margin: 16px 0 0; text-align: center; }

.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 10px 18px; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: .18s; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-2); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-danger { background: #fff; border-color: #f3c9c9; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: none; background: linear-gradient(180deg, #0a2778, #0b2a86);
  color: #dbe3ff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sb-brand { display: flex; gap: 11px; align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sb-mark {
  width: 36px; height: 36px; border-radius: 9px; background: rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; color: #fff;
}
.sb-text b { display: block; color: #fff; font-size: 14px; letter-spacing: .3px; }
.sb-text span { font-size: 11.5px; opacity: .65; }
.sb-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sb-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: #cfd9ff; text-decoration: none; font-size: 13.5px; cursor: pointer; margin-bottom: 2px; transition: .15s;
}
.sb-nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.sb-nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.sb-nav a i { font-style: normal; width: 16px; text-align: center; opacity: .85; }
.sb-sep { font-size: 11px; opacity: .5; padding: 14px 12px 6px; letter-spacing: 1px; }
.badge {
  margin-left: auto; background: #ef4444; color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-style: normal; font-weight: 700;
}
.sb-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 8px; }
.sb-link { color: #a9b8f0; font-size: 12.5px; text-decoration: none; }
.sb-link:hover { color: #fff; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--line); padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  position: sticky; top: 0; z-index: 20;
}
.tb-title h2 { margin: 0; font-size: 18px; }
.tb-title p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.save-status { font-size: 12.5px; color: var(--ok); }
.save-status.dirty { color: var(--warn); }
.view { padding: 26px 28px 60px; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card > h3 { margin: 0 0 4px; font-size: 15px; }
.card > .card-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 15px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--blue); line-height: 1.2; }
.stat-card .lbl { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field input[type=text], .field input[type=number], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; outline: none; background: #fdfdff; transition: .18s; color: var(--ink);
}
.field textarea { min-height: 78px; resize: vertical; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 45, 179, .09); background: #fff;
}
.field .hint { font-size: 11.5px; color: #8894ab; margin-top: 5px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.img-field { display: flex; gap: 12px; align-items: flex-start; }
.img-preview {
  width: 132px; height: 84px; border-radius: 8px; border: 1px solid var(--line);
  background: #f7f9ff center/cover no-repeat; flex: none; display: flex; align-items: center;
  justify-content: center; color: #a8b2c7; font-size: 11px;
}
.img-tools { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.img-tools input { font-size: 13px; }
.img-btns { display: flex; gap: 8px; }

.items { border: 1px solid var(--line); border-radius: 9px; padding: 14px; margin-bottom: 12px; background: #fbfcff; }
.items-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.items-head b { font-size: 12.5px; color: var(--blue); }
.item-block { border: 1px dashed #d3dbf0; border-radius: 8px; padding: 13px; margin-bottom: 10px; background: #fff; position: relative; }
.item-block .del-pos { position: absolute; top: 9px; right: 9px; }

.sub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.sub-tabs button {
  border: 1px solid var(--line); background: #fff; padding: 7px 15px; border-radius: 20px;
  font-size: 13px; cursor: pointer; font-family: inherit; color: var(--ink-2); transition: .15s;
}
.sub-tabs button:hover { border-color: var(--blue); color: var(--blue); }
.sub-tabs button.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }

table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbff; white-space: nowrap;
}
table.list td { padding: 11px 12px; border-bottom: 1px solid #f0f3fa; vertical-align: middle; }
table.list tr:hover td { background: #fafcff; }
table.list .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--blue); }
.tagline { font-size: 12px; color: #8894ab; }
.thumb-mini { width: 54px; height: 36px; border-radius: 5px; object-fit: cover; background: #eef1f7; }

.empty { text-align: center; padding: 46px 20px; color: var(--ink-2); }
.empty p { margin: 0 0 16px; }

.json-editor {
  width: 100%; min-height: 460px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.65; padding: 14px; border: 1px solid var(--line);
  border-radius: 9px; background: #fbfcff; outline: none; resize: vertical; color: var(--ink);
}
.json-editor:focus { border-color: var(--blue); background: #fff; }

.modal { position: fixed; inset: 0; background: rgba(9, 17, 43, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal[hidden] { display: none; }
.toast[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 720px; max-height: 82vh; display: flex; flex-direction: column; }
.modal-box h3 { margin: 0 0 14px; font-size: 16px; }
.modal-pre {
  background: #0b1220; color: #c9e2ff; padding: 16px; border-radius: 9px; font-size: 12px;
  overflow: auto; flex: 1; margin: 0 0 16px; white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.7;
}
.modal-foot { display: flex; justify-content: flex-end; }

/* 发布成功后的预览链接区（默认隐藏，注意 hidden 必须覆盖 display） */
.modal-extra { display: none; }
.modal-extra:not([hidden]) {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  margin: 0 0 16px; padding: 14px 16px; border-radius: 9px;
  background: #f1f6ff; border: 1px solid #cfe0ff;
}
.modal-extra .preview-open { display: inline-block; text-decoration: none; }
.modal-extra .preview-note { margin: 0; font-size: 12px; line-height: 1.6; color: #5b6b8c; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #12192b; color: #fff; padding: 11px 22px; border-radius: 24px;
  font-size: 13.5px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.ok { background: #0f9d58; }
.toast.err { background: #dc2626; }

.ai-note { background: var(--blue-soft); border-left: 3px solid var(--blue); padding: 12px 15px; border-radius: 0 8px 8px 0; font-size: 12.5px; color: #2c3a5c; margin-bottom: 18px; }

@media (max-width: 980px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sb-nav { display: flex; overflow-x: auto; gap: 4px; }
  .sb-nav a { white-space: nowrap; }
  .sb-sep, .sb-foot { display: none; }
  .grid-4, .row-2, .row-3 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .view { padding: 18px 14px 50px; }
}
