/* ===========================================================
   TREG 文档在线编辑系统 · 共享样式
   配色沿用原型：主色 #1565C0 / 深蓝 #0E3A5C / 强调 #00897B
   =========================================================== */
:root {
  --primary: #1565C0;
  --primary-dark: #0E3A5C;
  --primary-light: #E3F2FD;
  --accent: #00897B;
  --danger: #E53935;
  --warning: #F9A825;
  --purple: #7B1FA2;
  --text: #212121;
  --text-2: #616161;
  --text-3: #9E9E9E;
  --border: #E0E0E0;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.16);
  --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }

/* ===== 通用按钮 ===== */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; font-family: var(--font); transition: .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #0d47a1; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: transparent; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color:#fff; }
.btn-danger:hover { background:#c62828; color:#fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 卡片 ===== */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: auto; }

/* ===== 页面头 ===== */
.page-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .crumb { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.page-head .crumb b { color: var(--text); font-weight: 600; }
.page-head h1 { font-size: 18px; font-weight: 600; }
.page-head .desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.page-body { padding: 20px 24px; }
.spacer { flex: 1; }

/* ===== 状态标签 ===== */
.tag { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.tag-working { background: #E3F2FD; color: var(--primary); }      /* 工作中 */
.tag-review  { background: #FFF8E1; color: #B27800; }            /* 待审核 */
.tag-publish { background: #E1F5FE; color: #0277BD; }            /* 待发布 */
.tag-done    { background: #E0F2F1; color: var(--accent); }      /* 已完成 */
.tag-draft   { background: #F5F5F5; color: var(--text-2); }
.tag-editing { background: #E3F2FD; color: var(--primary); }
.tag-approving { background: #FFF8E1; color: #B27800; }
.tag-released { background: #E0F2F1; color: var(--accent); }
.tag-revising { background: #F3E5F5; color: var(--purple); }
.tag-danger  { background: #FFEBEE; color: var(--danger); }
.tag-warning { background: #FFF8E1; color: #B27800; }
.tag-lock    { background: #ECEFF1; color: #546E7A; }
.tag-sys     { background: #E1F5FE; color: #0277BD; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; color: var(--text-2); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); background: #FAFBFC; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #F0F0F0; vertical-align: middle; }
tr:hover td { background: #FAFBFD; }
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ===== 统计卡 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; cursor: pointer; transition:.15s; border-left: 3px solid var(--primary); }
.stat-card:hover { transform: translateY(-2px); }
.stat-value { font-size: 28px; font-weight: 700; font-family: "DIN Alternate", Arial, sans-serif; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.stat-c1 { border-left-color: var(--danger); } .stat-c1 .stat-value { color: var(--danger); }
.stat-c2 { border-left-color: var(--primary); } .stat-c2 .stat-value { color: var(--primary); }
.stat-c3 { border-left-color: var(--accent); } .stat-c3 .stat-value { color: var(--accent); }
.stat-c4 { border-left-color: var(--warning); } .stat-c4 .stat-value { color: var(--warning); }

/* ===== 两栏布局 ===== */
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ===== 表单 ===== */
input, select, textarea { font-family: var(--font); font-size: 13px; }
.search-input, input[type=text], input[type=password], input[type=email], select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 13px; background: #fff; outline: none; color: var(--text);
}
.search-input:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { width: 100%; min-height: 80px; resize: vertical; line-height: 1.6; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }

/* ===== 筛选条 ===== */
.chip { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(13,36,54,0.45); display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; max-height: 86vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ===== toast ===== */
#toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: var(--primary-dark); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 13px; display: none; z-index: 300; box-shadow: 0 4px 16px rgba(0,0,0,0.25); max-width: 80vw; }

/* ===== 原型说明条 ===== */
.proto-note { background: #FFFDE7; border: 1px solid #FFF59D; color: #8D6E00; font-size: 12px; border-radius: 8px; padding: 10px 14px; margin-bottom: 20px; line-height: 1.7; }

/* ===== 树 ===== */
.tree-node { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tree-node:hover { background: var(--bg); }
.tree-node.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tree-children { padding-left: 18px; }
.tree-toggle { width: 16px; text-align: center; color: var(--text-3); }

/* ===== 二级子导航（tab / 子菜单） ===== */
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.subnav .tab { padding: 10px 16px; cursor: pointer; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; }
.subnav .tab:hover { color: var(--text); }
.subnav .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== 列表项 ===== */
.list-item { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; cursor: pointer; background: #fff; transition: .15s; }
.list-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.list-item .avatar { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta .t { font-weight: 600; }
.list-item .meta .d { font-size: 12px; color: var(--text-2); }

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cdd5df; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #b0bac6; }

/* ===== 知识图谱/简单图形容器 ===== */
.graph-box { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
