/* 资讯管理后台样式 */
:root {
  --bg: #0b1017;
  --bg-soft: #111827;
  --bg-elev: #151d2b;
  --bg-input: #0e1521;
  --text: #e8eefa;
  --text-2: #93a2ba;
  --text-3: #64738c;
  --line: #212c3f;
  --line-2: #1a2333;
  --brand: #4d86ff;
  --brand-2: #14e0b4;
  --danger: #f0555a;
  --radius: 12px;
}
html[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-soft: #ffffff;
  --bg-elev: #ffffff;
  --bg-input: #ffffff;
  --text: #0d1524;
  --text-2: #55637a;
  --text-3: #8b96a9;
  --line: #e2e7f0;
  --line-2: #eef1f7;
  --brand: #1f5eff;
  --brand-2: #00b98f;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
}
input, textarea, select, button { font-family: inherit; font-size: 14px; }
input[type=text], input[type=search], input[type=password], input:not([type]), textarea, select {
  width: 100%; background: var(--bg-input); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(77, 134, 255, .18); }
textarea { resize: vertical; line-height: 1.6; }
::placeholder { color: var(--text-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  transition: all .16s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* 门禁 */
.gate { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: var(--bg); }
.gate[hidden] { display: none; }
.gate-box { width: 330px; text-align: center; }
.gate-logo {
  width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; font-size: 18px;
}
.gate-box h2 { margin: 0 0 6px; font-size: 19px; }
.gate-box p { margin: 0 0 18px; color: var(--text-3); font-size: 13px; }
.gate-box input { margin-bottom: 12px; text-align: center; }
.gate-tip { margin-top: 12px; font-size: 12.5px; color: var(--danger); min-height: 18px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 10px; }
.tb-left b { font-size: 15px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.tb-status { font-size: 12px; color: var(--text-3); padding-left: 6px; }
.tb-right { display: flex; gap: 8px; }

/* 布局 */
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 0; height: calc(100vh - 54px); }
.sidebar { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg-soft); }
.side-top { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.filters { display: flex; gap: 6px; }
.chip {
  flex: 1; padding: 6px 0; border-radius: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 12.5px;
}
.chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.side-list { flex: 1; overflow-y: auto; padding: 8px; }
.li {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px;
}
.li:hover { background: var(--bg-elev); }
.li.is-on { background: var(--bg-elev); border-color: var(--brand); }
.li-t { font-size: 13.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-m { display: flex; gap: 6px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.dot-pub { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); }
.dot-draft { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.li-empty { padding: 24px 12px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 编辑区 */
.pane { overflow-y: auto; padding: 20px 24px 90px; }
.pane-head { margin-bottom: 16px; }
.title-input {
  font-size: 22px !important; font-weight: 700; padding: 12px 14px !important; border-radius: 11px !important;
}
.slug-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.slug-pre, .slug-suf { color: var(--text-3); font-size: 12.5px; font-family: ui-monospace, Consolas, monospace; }
.slug-row input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.meta-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.meta-grid .wide { grid-column: span 4; }
.cover-row { display: flex; gap: 8px; }
.cover-row input { flex: 1; }
.kw-box { display: flex; gap: 8px; }
.kw-box input { flex: 1; }
.kw-actions { display: flex; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-kw {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px dashed var(--line); color: var(--text-2); background: transparent;
}
.chip-kw:hover { border-color: var(--brand); color: var(--brand); }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; background: var(--bg-elev);
}
.toolbar button {
  min-width: 32px; height: 30px; padding: 0 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text-2); font-size: 13px;
}
.toolbar button:hover { background: var(--bg-input); color: var(--brand); border-color: var(--line); }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.tb-gap { flex: 1; }
.tb-note { font-size: 12px; color: var(--text-3); }

/* 2026-10-26 新增：字号下拉与文字颜色控件（与工具栏按钮同高同风格） */
.tb-select {
  height: 30px; padding: 0 4px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-input); color: var(--text-2); font-size: 13px;
}
.tb-select:hover { border-color: var(--brand); color: var(--brand); }
.tb-color {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 30px; padding: 0 7px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent; color: var(--text-2); font-size: 13px; font-weight: 700;
}
.tb-color:hover { background: var(--bg-input); color: var(--brand); border-color: var(--line); }
.tb-color input[type="color"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0;
}

.editor-wrap { position: relative; border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: var(--bg-soft); }
.editor {
  min-height: 420px; padding: 22px 26px; outline: none; font-size: 15.5px; line-height: 1.9; color: var(--text);
  overflow-wrap: break-word;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.editor p { margin: 0 0 14px; }
.editor h2 { font-size: 20px; margin: 22px 0 12px; }
.editor h3 { font-size: 17px; margin: 18px 0 10px; }
.editor img { max-width: 100%; border-radius: 8px; margin: 10px 0; }
.editor blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--brand-2); background: var(--bg-input); color: var(--text-2); }
.editor ul, .editor ol { padding-left: 24px; }
.editor a.kw { color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 12%, transparent); padding: 1px 4px; border-radius: 4px; }
.editor.is-drag { outline: 2px dashed var(--brand); outline-offset: -6px; }
.editor-count { position: absolute; right: 12px; bottom: 8px; font-size: 12px; color: var(--text-3); }

.paste-plain { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--bg-elev); }
.paste-plain[hidden] { display: none; }
.paste-plain textarea { min-height: 140px; }
.pp-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* 操作条 */
.action-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px;
  margin-top: 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); box-shadow: 0 -6px 20px rgba(0, 0, 0, .16);
}
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch input { width: 15px; height: 15px; accent-color: var(--brand); }
.grow { flex: 1; }
.state-badge { font-size: 12px; color: var(--text-3); }
.state-badge.on { color: var(--brand-2); }

/* 模态 */
.modal { position: fixed; inset: 0; z-index: 800; display: grid; place-items: center; background: rgba(6, 10, 16, .62); backdrop-filter: blur(3px); padding: 24px; }
.modal[hidden] { display: none; }
.modal-box { width: 640px; max-height: 86vh; overflow-y: auto; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.modal-box.wide-box { width: 960px; height: 86vh; display: flex; flex-direction: column; padding: 14px; }
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.set-grid .wide { grid-column: span 2; }
.set-grid textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.pv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pv-head h3 { margin: 0; }
#pvFrame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 999;
  padding: 11px 20px; border-radius: 10px; background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .3); font-size: 13.5px; max-width: 78vw;
}
.toast[hidden] { display: none; }
.toast.ok { border-color: var(--brand-2); }
.toast.err { border-color: var(--danger); color: var(--danger); }

@media (max-width: 1100px) {
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-grid .wide { grid-column: span 2; }
  .layout { grid-template-columns: 240px 1fr; }
}
@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
}
