/* =====================================================================
   赢思派官网 CMS · 后台样式（无外部依赖，PC / 移动端自适应）
   ===================================================================== */
:root {
  --brand: #0b3a58;
  --brand-2: #006dac;
  --gold: #f3ca20;
  --bg: #f4f6f8;
  --card: #fff;
  --line: #e3e8ee;
  --text: #1f2933;
  --muted: #7b8794;
  --ok: #1f9d55;
  --warn: #c7861a;
  --err: #d64545;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--brand);
  color: #cfe1ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand a { color: #fff; display: block; }
.brand b { font-size: 18px; letter-spacing: .06em; }
.brand small { display: block; color: #8fb3ca; font-size: 12px; letter-spacing: .12em; }

.sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #b9d3e4; font-size: 14px;
}
.sidebar nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--brand-2); color: #fff; }
.sidefoot { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidefoot a { display: block; padding: 8px 20px; color: #8fb3ca; font-size: 13px; }
.sidefoot a:hover { color: #fff; text-decoration: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 58px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topright { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.burger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }

.content { padding: 22px; }

/* ---------------- 卡片 / 表格 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
}
.card-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbfcfd;
}
.card-hd h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-hd .sp { margin-left: auto; }
.card-bd { padding: 18px; }
.card-bd.p0 { padding: 0; }

table.tb { width: 100%; border-collapse: collapse; }
table.tb th, table.tb td {
  padding: 11px 12px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle; font-size: 13.5px;
}
table.tb th { background: #f8fafb; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.tb tr:hover td { background: #fafcfd; }
table.tb .w40 { width: 40px; }
table.tb .w60 { width: 60px; }
table.tb .w100 { width: 100px; }
table.tb .w140 { width: 140px; }
table.tb .w180 { width: 180px; }
table.tb .ops { white-space: nowrap; }
table.tb .ops a { margin-right: 8px; font-size: 13px; }
table.tb .drag { cursor: move; color: #b7c2cd; }

.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 4px; background: #eef1f4; display: block; }
.thumb-lg { max-width: 220px; border-radius: 4px; border: 1px solid var(--line); }

/* ---------------- 表单 ---------------- */
.form-row { margin-bottom: 16px; }
.form-row > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.form-row .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d3dae1; border-radius: 4px;
  font: inherit; color: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(0,109,172,.1); }
textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
textarea.code { font-family: Consolas, Menlo, monospace; font-size: 12.5px; min-height: 160px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.inline { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.inline label { display: flex; align-items: center; gap: 6px; font-weight: normal; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 4px; border: 1px solid transparent;
  background: #eef1f4; color: var(--text); cursor: pointer; font: inherit; font-size: 13.5px;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--brand-2); color: #fff; }
.btn-gold { background: var(--gold); color: #26200a; }
.btn-line { background: #fff; border-color: #d3dae1; color: var(--text); }
.btn-danger { background: #fdecec; color: var(--err); border-color: #f6cfcf; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------------- 提示 ---------------- */
.flash { padding: 11px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 13.5px; }
.flash-ok { background: #e8f7ef; color: #116b3a; border: 1px solid #bfe8d2; }
.flash-err { background: #fdecec; color: #a12b2b; border: 1px solid #f6cfcf; }
.flash-warn { background: #fff7e6; color: #8a6100; border: 1px solid #ffe3a8; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag-ok { background: #e8f7ef; color: #116b3a; }
.tag-warn { background: #fff7e6; color: #8a6100; }
.tag-muted { background: #eef1f4; color: var(--muted); }
.tag-info { background: #e7f3fb; color: #0a5b8c; }
.tag-top { background: #fdf6d8; color: #7a5b00; }

/* ---------------- 统计 ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; color: var(--brand); }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; gap: 6px; padding: 14px 18px; flex-wrap: wrap; align-items: center; }
.pager a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }
.pager a.cur { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.pager span { color: var(--muted); }

/* ---------------- 富文本编辑器 ---------------- */
.editor { border: 1px solid #d3dae1; border-radius: 4px; overflow: hidden; background: #fff; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: #f7f9fb; border-bottom: 1px solid var(--line); }
.editor-bar button {
  min-width: 30px; padding: 4px 8px; border: 1px solid transparent; background: none;
  border-radius: 3px; cursor: pointer; font-size: 13px; color: #40505f;
}
.editor-bar button:hover { background: #e7eef4; }
.editor-bar .sep { width: 1px; background: var(--line); margin: 2px 4px; }
.editor-area { min-height: 380px; max-height: 70vh; overflow-y: auto; padding: 16px 18px; outline: 0; }
.editor-area:focus { box-shadow: inset 0 0 0 2px rgba(0,109,172,.08); }
.editor-area img { max-width: 100%; height: auto; }
.editor-area table { max-width: 100%; }
.editor textarea { border: 0; min-height: 380px; border-radius: 0; font-family: Consolas, Menlo, monospace; font-size: 12.5px; }

/* ---------------- 媒体库 ---------------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.media-grid .item { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #fff; cursor: pointer; }
.media-grid .item img { width: 100%; height: 90px; object-fit: cover; display: block; background: #eef1f4; }
.media-grid .item span { display: block; padding: 4px 6px; font-size: 11px; color: var(--muted); word-break: break-all; }

/* ---------------- 登录 ---------------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #0b3a58;
  background-image: radial-gradient(circle at 30% 20%, #13496b 0, #0b3a58 55%);
}
.login-card { width: 360px; max-width: 92vw; background: #fff; border-radius: 8px; padding: 30px 28px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand b { display: block; font-size: 24px; letter-spacing: .12em; color: var(--brand); }
.login-brand small { color: var(--muted); letter-spacing: .18em; font-size: 12px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #40505f; }
.login-card input { margin-top: 6px; }
.login-card .btn { margin-top: 8px; padding: 10px; }
.login-tip { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100; height: 100%;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: none; }
  .burger { display: block; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 15px; }
  .content { padding: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  table.tb { display: block; overflow-x: auto; white-space: nowrap; }
  .card-bd { padding: 14px; }
  .editor-area { min-height: 260px; }
  .form-row .grid2 { gap: 10px; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .topright .btn { padding: 6px 10px; font-size: 12px; }
}

/* 单页正文里的表格（如「公司简介」六段介绍）在编辑器里也要规整可读 */
.editor-area table { width: 100% !important; border-collapse: collapse; table-layout: auto; }
.editor-area table td, .editor-area table th { padding: 8px 10px; vertical-align: top; }
.editor-hint { margin: 10px 0 0; font-size: 12.5px; color: #8a9aa8; line-height: 1.9; }
.editor-hint b { color: #006dac; }
/* ---------------- 顶栏欢迎语 ---------------- */
.topwelcome {
  color: #40505f;
  font-size: 13px;
  margin-right: 4px;
  white-space: nowrap;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  height: 30px;          /* 与按钮同高，文字垂直居中 */
}

/* ---------------- 键值表格（服务器信息） ---------------- */
.tb-kv th {
  width: 120px;
  background: #f7f9fb;
  color: #5a6b7a;
  font-weight: 500;
  font-size: 12.5px;
  border-right: 1px solid #eef1f4;
}
.tb-kv td {
  color: #1f2933;
  font-size: 13px;
  border-right: 1px solid #eef1f4;
}
.tb-kv tr:last-child th, .tb-kv tr:last-child td { border-bottom: 0; }
@media (max-width: 720px) {
  .tb-kv th, .tb-kv td { display: block; width: 100%; border-right: 0; }
  .topwelcome { display: none; }
}
/* ---------------- 文章列表：左侧栏目树 ---------------- */
.cat-layout { display: flex; gap: 14px; align-items: flex-start; }
.cat-tree {
  flex: 0 0 208px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.cat-tree-hd {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px 8px;
  letter-spacing: .04em;
}
.cat-tree .cat-item {
  display: block;
  padding: 6px 8px;
  border-radius: 5px;
  color: #33424f;
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-tree .cat-item:hover { background: #f1f5f9; }
.cat-tree .cat-item.active { background: var(--brand-2); color: #fff; }
.cat-tree .cat-item.active .cnt { color: rgba(255, 255, 255, .8); }
.cat-tree .lv0 { font-weight: 600; }
.cat-tree .lv1 { padding-left: 18px; }
.cat-tree .lv2 { padding-left: 30px; color: #55636f; font-size: 12.5px; }
.cat-tree .lv3 { padding-left: 42px; color: #6b7885; font-size: 12px; }
.cat-tree .cnt { float: right; color: #9aa7b2; font-size: 11.5px; margin-left: 6px; }
.cat-main { flex: 1; min-width: 0; }
.cat-main > .card { margin-bottom: 14px; }
@media (max-width: 980px) {
  .cat-layout { flex-direction: column; }
  .cat-tree { flex: none; width: 100%; position: static; max-height: 260px; }
}