/* =========================================================
   富特资料库 · 浅色主题（docs.html）
   与 wiki.css / style.css 共用同一套浅色变量
   ========================================================= */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f2f5f9;
  --panel-3: #eaeff6;
  --border: #e4e9f0;
  --border-2: #d5dce6;
  --text: #1f2733;
  --text-dim: #6b7683;
  --text-soft: #98a3b1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eef3fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
#app {
  display: grid; grid-template-columns: 272px 1fr 42%;
  grid-template-rows: minmax(0, 1fr); height: 100vh;
}
#sidebar, #main, #preview { min-height: 0; }

/* ---------------- 侧栏 ---------------- */
#sidebar {
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-width: 0;
}
.brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.brand-title { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.brand-sub a {
  display: inline-block; color: var(--accent); text-decoration: none;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; margin-top: 8px;
  border: 1px solid var(--border-2); border-radius: 999px; transition: .15s;
}
.brand-sub a:hover { background: var(--accent-soft); border-color: var(--accent); }
.search-wrap { padding: 12px 14px 8px; }
#search {
  width: 100%; padding: 9px 13px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  outline: none; font-size: 13px; transition: .15s;
}
#search::placeholder { color: var(--text-soft); }
#search:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.type-filters {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.tf {
  font-size: 11.5px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-2); color: var(--text-dim); user-select: none;
  background: #fff; transition: .15s;
}
.tf:hover { border-color: var(--accent); color: var(--accent); }
.tf.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.tree { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 24px; }
.tree-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text); transition: .12s; margin-bottom: 2px;
}
.tree-item:hover { background: var(--panel-2); }
.tree-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree-ico { flex: none; font-size: 13px; }
.tree-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-count {
  color: var(--text-dim); font-size: 11px; background: var(--panel-2);
  padding: 1px 7px; border-radius: 999px; flex: none;
}
.tree-item.active .tree-count { background: #fff; color: var(--accent); }

/* ---------------- 中栏：文件列表 ---------------- */
#main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
#topbar {
  min-height: 56px; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
#crumb { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; }
#crumb::before { content: ""; flex: none; width: 4px; height: 16px; border-radius: 2px; background: var(--accent); }
.hint { color: var(--text-dim); font-size: 11.5px; text-align: right; }

/* ---------------- 工具栏：下拉筛选 ---------------- */
#toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border);
}
#toolbar .tb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
#toolbar select {
  font: inherit; font-size: 12.5px; padding: 6px 26px 6px 10px; max-width: 280px;
  color: var(--text); background-color: var(--panel-2);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7683' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  border: 1px solid var(--border-2); border-radius: 8px;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  text-overflow: ellipsis; transition: .15s;
}
#toolbar select:hover { border-color: var(--accent); }
#toolbar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background-color: #fff; }
#toolbar select:disabled { opacity: .55; cursor: not-allowed; }
#countLabel {
  margin-left: auto; font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
#listWrap { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 44px; }
#fileTable {
  width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
#fileTable th:nth-child(2), #fileTable td:nth-child(2) { width: 86px; }
#fileTable th:nth-child(3), #fileTable td:nth-child(3) { width: 24%; }
#fileTable th:nth-child(4), #fileTable td:nth-child(4) { width: 92px; }
#fileTable th:nth-child(5), #fileTable td:nth-child(5) { width: 94px; }
#fileTable thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2); text-align: left; font-size: 11.5px;
  color: var(--text-dim); font-weight: 600; letter-spacing: .4px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
}
#fileTable tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 0; vertical-align: middle;
}
#fileTable tbody tr { cursor: pointer; transition: background .12s; }
#fileTable tbody tr:last-child td { border-bottom: 0; }
#fileTable tbody tr:hover { background: var(--panel-2); }
#fileTable tbody tr.active { background: var(--accent-soft); }
.f-name { color: var(--text); font-weight: 500; }
.f-badge {
  display: inline-block; font-size: 10.5px; padding: 2px 9px;
  border-radius: 999px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.f-sub { color: var(--text-dim); font-size: 12px; }
.f-size { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.f-open { color: var(--accent); text-decoration: none; font-size: 12px; font-weight: 600; white-space: nowrap; }
.f-open:hover { text-decoration: underline; }
.loadmore {
  margin: 18px auto 0; padding: 10px 22px; text-align: center; width: max-content;
  color: var(--accent); cursor: pointer; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border-2); border-radius: 999px; background: #fff;
  transition: .15s;
}
.loadmore:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------------- 右栏：预览 ---------------- */
#preview {
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-width: 0;
}
#pvEmpty {
  color: var(--text-soft); text-align: center; margin-top: 84px;
  font-size: 13px; padding: 0 32px; line-height: 1.9;
}
#pvContent { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.pv-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.pv-name { flex: 1; font-weight: 700; font-size: 14px; word-break: break-all; line-height: 1.45; }
.pv-open {
  flex: none; color: #fff; background: var(--accent); text-decoration: none;
  font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 8px;
  transition: .15s; white-space: nowrap;
}
.pv-open:hover { background: var(--accent-hover); }
.pv-note {
  padding: 8px 18px; font-size: 11.5px; color: var(--text-dim);
  background: var(--accent-soft); border-bottom: 1px solid var(--border);
}
#pvNote:empty { display: none; }
.pv-body { flex: 1; min-height: 0; background: var(--panel-2); }
.pv-body iframe, .pv-body img { width: 100%; height: 100%; border: 0; background: var(--panel-2); }
.pv-body img { object-fit: contain; }
.pv-msg { padding: 30px; color: var(--text-dim); font-size: 13px; line-height: 1.9; }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cfd8e3; border-radius: 6px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b4c0d0; background-clip: content-box; }
