/* 程序文档管理系统 - Web 版样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
}
.login-card {
  background: var(--card); width: 380px; padding: 40px 36px;
  border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo { font-size: 22px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 26px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--primary); }
.login-error { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.divider { text-align: center; color: var(--muted); margin: 16px 0; font-size: 12px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 54px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 16px; flex-shrink: 0;
}
.brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-title { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.brand-ver { font-size: 11px; color: var(--muted); }
.searchbox { position: relative; flex: 1; max-width: 560px; }
.searchbox input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px;
}
.searchbox input:focus { outline: none; border-color: var(--primary); }
.search-panel {
  position: absolute; top: 38px; left: 0; right: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 420px; overflow: auto; z-index: 100;
}
.top-stats { color: var(--muted); font-size: 12px; white-space: nowrap; }
.userbox { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.role-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #e0e7ff; color: var(--primary-dark);
}

/* ---------- 布局 ---------- */
.layout { flex: 1; display: flex; overflow: hidden; }
.sidebar {
  width: 280px; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.side-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.tree { flex: 1; overflow: auto; padding: 8px 0; }
.tree-item { display: flex; align-items: center; gap: 6px; padding: 8px 14px; cursor: pointer; }
.tree-item:hover { background: var(--bg); }
.tree-item.active { background: #e0e7ff; color: var(--primary-dark); }
.tree-ctrl { font-weight: 600; }
.tree-prog { padding-left: 32px; font-size: 13px; }
.tree-code { font-size: 11px; color: var(--muted); }
.tree-count { margin-left: auto; font-size: 11px; color: var(--muted); }
.tree-caret { width: 14px; text-align: center; color: var(--muted); }

.content { flex: 1; overflow: auto; padding: 20px; }
.empty-hint { color: var(--muted); text-align: center; margin-top: 120px; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.card h3 .sub { font-size: 12px; color: var(--muted); font-weight: normal; margin-left: 8px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.info-item { font-size: 13px; }
.info-item .k { color: var(--muted); font-size: 12px; }
.info-item .v { margin-top: 2px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 8px 10px; background: #f8fafc; color: var(--muted);
  font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.tbl tr:hover td { background: #f8fafc; }
table.tbl .ops { white-space: nowrap; }
table.tbl .ops a { margin-right: 10px; font-size: 12px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.badge-latest { background: #dcfce7; color: var(--green); }
.badge-empty { background: #f1f5f9; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- 时间线 ---------- */
.timeline { border-left: 2px solid var(--border); margin-left: 8px; padding-left: 18px; }
.tl-item { position: relative; padding: 6px 0 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -24px; top: 8px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff;
}
.tl-title { font-weight: 600; font-size: 13px; }
.tl-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tl-detail { font-size: 12px; color: #334155; margin-top: 4px; white-space: pre-wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--text); font-size: 13px; cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); cursor: pointer; font-size: 16px; line-height: 1;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  height: 46px; background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; padding: 0 16px; flex-shrink: 0;
  overflow-x: auto;
}
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--card); border-radius: 12px; width: 560px; max-width: 94vw;
  max-height: 88vh; overflow: auto; padding: 22px;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .field { margin-bottom: 14px; }
.modal textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; resize: vertical; }
.modal textarea:focus { outline: none; border-color: var(--primary); }
.modal .row { display: flex; gap: 10px; }
.modal .row .field { flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-foot .btn { min-width: 72px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 20px; border-radius: 20px;
  font-size: 13px; z-index: 300; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* 搜索结果条目 */
.sr-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sr-item:hover { background: var(--bg); }
.sr-item .t { font-weight: 600; font-size: 13px; }
.sr-item .d { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-type { font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }

/* 联动勾选（企微设置事件） */
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check-grid label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }

@media (max-width: 760px) {
  .sidebar { width: 200px; }
  .top-stats { display: none; }
}
