/* 自媒体存稿与发布管理系统 — 后台样式（零外部依赖） */
:root {
  --brand: #4f46e5;
  --brand-weak: #eef2ff;
  --ink: #1f2430;
  --ink-2: #5b6478;
  --ink-3: #8a92a6;
  --line: #e8ebf2;
  --bg: #f5f7fb;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #2563eb;
  --purple: #7c3aed;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: #4338ca; }

/*---------------- 布局 ----------------*/
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: linear-gradient(180deg, #1f2440 0%, #2b3157 100%);
  color: #cfd4e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  padding: 22px 20px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand span { display: block; font-size: 11px; font-weight: 400; color: #8f97b8; margin-top: 4px; letter-spacing: 0; }

.sidebar .nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar .nav .group-title {
  font-size: 11px;
  color: #7d86a8;
  padding: 12px 12px 6px;
  letter-spacing: 1px;
}
.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: #c7cde3;
  font-size: 14px;
  transition: .15s;
}
.sidebar .nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav a.active { background: linear-gradient(90deg, var(--brand), #6d5ff6); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.sidebar .nav a .badge-n { margin-left: auto; background: #ffffff22; color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; }

.sidebar .side-foot { padding: 14px 16px; font-size: 12px; color: #8f97b8; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .side-foot b { color: #e6e9f5; display: block; margin-bottom: 3px; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .crumb { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .who { font-size: 13px; color: var(--ink-2); }
.topbar .who b { color: var(--ink); }

.content { padding: 20px 22px 40px; }

/*---------------- 通用组件 ----------------*/
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head .sub { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.card-body { padding: 18px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 1100px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: .5px; }
.stat .tail { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.stat.dot-blue { border-left: 4px solid var(--blue); }
.stat.dot-orange { border-left: 4px solid var(--orange); }
.stat.dot-green { border-left: 4px solid var(--green); }
.stat.dot-purple { border-left: 4px solid var(--purple); }
.stat.dot-brand { border-left: 4px solid var(--brand); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfd6e6; box-shadow: 0 2px 8px rgba(16,24,40,.06); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #4338ca; color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: #fff; border-color: #f2c6c6; color: var(--red); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-ghost { background: transparent; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.table th { background: #fafbfe; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
table.table tbody tr:hover { background: #fafbff; }
table.table td .mini { font-size: 12px; color: var(--ink-3); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}
.st-gray { background: #f1f3f8; color: #6b7280; }
.st-blue { background: #e8f1ff; color: #1d4ed8; }
.st-orange { background: #fff3e0; color: #b45309; }
.st-purple { background: #f4ecfe; color: #7c3aed; }
.st-green { background: #e7f8ee; color: #15803d; }
.st-brand { background: var(--brand-weak); color: #4338ca; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: #f3f5fa;
  color: var(--ink-2);
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; font-weight: 500; }
.form-row label .req { color: var(--red); margin-right: 3px; }
.form-row .tip { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

input[type=text], input[type=password], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dfe3ed;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
select { cursor: pointer; }
textarea { resize: vertical; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.filters .field { min-width: 150px; }
.filters .field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.filters .field input, .filters .field select { padding: 7px 10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar .left, .toolbar .right { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.empty { padding: 48px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty .ico { font-size: 30px; margin-bottom: 8px; opacity: .5; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 18px; justify-content: flex-end; }
.pagination a, .pagination span {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; background: #fff; color: var(--ink-2);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(16,24,40,.12);
  border-radius: 10px; padding: 11px 18px; font-size: 13px; display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s ease;
}
.toast.ok { border-left: 4px solid var(--green); }
.toast.err { border-left: 4px solid var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/*---------------- 预览 ----------------*/
.preview-page { min-height: 100vh; background: #eef0f6; }
.preview-bar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 12px; flex-wrap: wrap;
}
.preview-bar .title { font-weight: 600; font-size: 15px; }
.preview-bar .title small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.preview-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-tabs a {
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; color: var(--ink-2); background: #fff;
}
.preview-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.preview-body { padding: 18px; }
.preview-hint {
  background: #fff; border: 1px dashed #cfd6e6; border-radius: 10px; padding: 10px 14px; font-size: 12px; color: var(--ink-2);
  margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start;
}
.preview-cols { display: grid; gap: 16px; }
.preview-cols.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .preview-cols.cols-2 { grid-template-columns: 1fr; } }
.pv-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.pv-panel > .pv-head {
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: #fafbfe; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.pv-panel iframe { width: 100%; border: 0; flex: 1; min-height: 720px; background: #fff; }

/*---------------- 编辑器 ----------------*/
.editor-wrap { border: 1px solid #dfe3ed; border-radius: 10px; overflow: hidden; }
.editor-wrap .toolbar-box { border-bottom: 1px solid var(--line); }
.mode-switch { display: inline-flex; border: 1px solid #dfe3ed; border-radius: 8px; overflow: hidden; }
.mode-switch button {
  border: 0; background: #fff; padding: 7px 16px; font-size: 13px; cursor: pointer; color: var(--ink-2); font-family: inherit;
}
.mode-switch button.active { background: var(--brand); color: #fff; }
.rich-box { min-height: 420px; }
.md-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.md-cols .md-input { border-right: 1px solid var(--line); }
.md-cols textarea.md-area { border: 0; min-height: 460px; line-height: 1.8; font-family: Menlo, Consolas, "Courier New", monospace; font-size: 14px; }
.md-cols .md-view { padding: 18px 20px; overflow-y: auto; max-height: 560px; background: #fcfcff; }
.CodeMirror { font-size: 14px; height: auto; }
.editor-view-wrap { padding: 20px 24px; background: #fff; }
.article-view { max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 32px 30px; }
.article-view h1.title { font-size: 24px; margin: 0 0 18px; line-height: 1.45; text-align: center; }
.article-view .meta { text-align: center; font-size: 12px; color: var(--ink-3); margin-bottom: 26px; }
.article-view .body-content { font-size: 16px; line-height: 1.8; color: #3f3f3f; }
.article-view .body-content img { max-width: 100%; }

.publish-box {
  border: 1px solid #cfe6d8; background: #f4fbf7; border-radius: 10px; padding: 14px 16px;
}
.publish-box.is-active { border-color: var(--orange); background: #fffaf1; }

.hint {
  background: var(--brand-weak); border: 1px solid #dfe2ff; color: #3730a3;
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px; line-height: 1.7;
}

/*---------------- 登录 ----------------*/
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
}
.login-card {
  width: 380px; background: #fff; border-radius: 16px; padding: 34px 32px 28px;
  box-shadow: 0 24px 60px rgba(30, 41, 90, .28);
}
.login-card h2 { margin: 0 0 6px; font-size: 20px; text-align: center; }
.login-card .desc { text-align: center; color: var(--ink-3); font-size: 13px; margin-bottom: 24px; }
.login-card .form-row label { font-size: 13px; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; }
.login-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 18px; }

.copy-btn { cursor: pointer; }
