/* ============================================================
   部门文件工作台 · 样式（收紧版）
   风格：左栏导航 + 右内容区；浅色底、中性灰；
   用克制的蓝色强调色做重点；信息更密、层次更清晰；自适应。
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --line: #e6e8eb;
  --line-strong: #d4d8dd;
  --text: #23272e;
  --weak: #8a9099;
  --accent: #2f6fe0;
  --accent-weak: #eaf1fd;
  --hover: #f1f3f6;
  --danger: #d2433a;
  --size: 14px;

  /* 文件类型色 */
  --t-word: #2b579a;
  --t-excel: #217346;
  --t-ppt: #d24726;
  --t-pdf: #e03c31;
  --t-other: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--size);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* 整体两栏 */
.app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 212px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 10px;
}
.brand {
  font-weight: 700; font-size: 15px; color: var(--text);
  padding: 2px 10px 14px; letter-spacing: .3px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; color: var(--text);
  text-align: left; padding: 9px 10px;
  border-radius: 8px; font-size: 13.5px; cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active {
  background: var(--accent-weak); color: var(--accent);
  font-weight: 600; border-left-color: var(--accent);
}
.nav-ico { font-size: 14px; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
}

.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 8px; border-top: 1px solid var(--line); position: relative;
}

/* 侧边栏「最近编辑」面板（仿钉钉） */
.side-recents {
  flex: 1; min-height: 0; margin-top: 12px;
  display: flex; flex-direction: column;
}
.side-recents-title {
  font-size: 11px; color: var(--weak); font-weight: 600;
  padding: 2px 12px 6px; letter-spacing: .5px;
}
.recent-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 6px; display: flex; flex-direction: column; gap: 1px; }
.recent-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; color: var(--text);
}
.recent-item:hover { background: var(--hover); }
.recent-ico {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 9px; letter-spacing: .3px;
}
.recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { font-size: 10.5px; color: var(--weak); flex-shrink: 0; }
.side-name { color: var(--weak); font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 6px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--hover); }

.menu {
  position: absolute; bottom: 46px; left: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; min-width: 120px; z-index: 20;
  box-shadow: 0 4px 14px rgba(20,30,50,.10);
}
.menu-item { padding: 8px 14px; cursor: pointer; font-size: 13px; }
.menu-item:hover { background: var(--hover); }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap;
}
.scope-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.scope-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); }
.count { font-size: 12px; font-weight: 500; color: var(--weak); }
.head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px;
  font-size: 13px; width: 190px; max-width: 46vw; flex: 1 1 150px; min-width: 130px; outline: none; background: var(--surface);
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #2962c7; }
.btn-danger { border-color: #e9c4c1; color: var(--danger); }
.btn-danger:hover { background: #fbeceb; }

/* 面包屑 */
.breadcrumb {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 20px 0; font-size: 12.5px; color: var(--weak);
}
.breadcrumb .crumb { cursor: pointer; color: var(--accent); }
.breadcrumb .crumb.current { color: var(--text); cursor: default; font-weight: 600; }
.breadcrumb .sep { color: var(--weak); }

/* 区块小标题（层次更清晰） */
.section-label {
  font-size: 12px; color: var(--weak); font-weight: 600;
  padding: 14px 20px 6px; letter-spacing: .4px;
}

/* 文件列表（桌面：行；移动：卡片） */
.file-list { padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 4px; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 13px;
}
.file-item:hover { border-color: var(--line-strong); background: #fcfcfd; }
.fi-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.fi-icon.folder { background: #eef1f5; color: var(--weak); font-size: 17px; }
.fi-main { flex: 1; min-width: 0; }
.fi-name {
  font-size: 14px; color: var(--text); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fi-meta { font-size: 12px; color: var(--weak); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.fi-tag {
  display: inline-block; padding: 0 7px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 11px; color: var(--weak);
}
.fi-tag.dept { color: var(--accent); border-color: #cfe0f3; background: var(--accent-weak); }
.fi-tag.t { color: #b06a00; border-color: #f0d9a8; background: #fff5e0; }
.star-btn.on { color: #e6a700; border-color: #f0d27a; background: #fff7e0; font-weight: 600; }
.fi-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* 空状态 */
.empty { padding: 40px 0; text-align: center; color: var(--weak); font-size: 13px; }

/* 弹层 */
.modal {
  position: fixed; inset: 0; background: rgba(15,20,30,.34);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-card {
  background: var(--surface); border-radius: 12px; width: min(92vw, 460px);
  max-height: 86vh; overflow: auto; border: 1px solid var(--line);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.modal-body.no-pad { padding: 0; }
.field-label { font-size: 12px; color: var(--weak); }
.field-input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; outline: none; background: var(--surface); width: 100%;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.modal-submit { margin-top: 4px; }

/* 移动选择列表（可嵌套） */
.move-crumb { padding: 10px 16px 4px; font-size: 12.5px; color: var(--weak); }
.move-crumb .c { cursor: pointer; color: var(--accent); }
.move-crumb .c.current { color: var(--text); cursor: default; }
.move-list { padding: 4px 8px 10px; max-height: 46vh; overflow: auto; }
.move-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; cursor: pointer; border-radius: 8px; font-size: 13px;
}
.move-item:hover { background: var(--hover); }
.move-item .go { color: var(--accent); font-size: 12px; }
.req-actions { display: flex; gap: 6px; }
.modal-foot { padding: 10px 16px; border-top: 1px solid var(--line); text-align: right; }

/* 管理员表格 */
.file-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.file-table thead th {
  text-align: left; font-weight: 600; color: var(--weak);
  padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc;
}
.file-table tbody td { padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.file-table tbody tr:last-child td { border-bottom: none; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 9px 15px; border-radius: 8px;
  font-size: 13px; z-index: 80;
}

/* 移动端：侧边栏转顶部导航，文件转卡片网格 */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    padding: 9px 12px; border-right: none; border-bottom: 1px solid var(--line);
    gap: 8px;
  }
  .brand { padding: 0 6px 0 2px; font-size: 14px; }
  .nav { flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; }
  .nav-item { padding: 7px 11px; white-space: nowrap; border-left: none; }
  .nav-item.active { border-left: none; }
  .side-user { margin-top: 0; border-top: none; padding: 0; }
  .menu { bottom: 38px; }
  .side-recents { display: none; }

  .main-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .search { width: 100%; order: 3; }
  .head-right { width: 100%; justify-content: space-between; }

  .breadcrumb { padding: 10px 14px 0; }
  .section-label { padding: 12px 14px 4px; }
  .file-list { padding: 4px 14px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .file-item { flex-direction: column; align-items: flex-start; gap: 7px; }
  .fi-actions { width: 100%; flex-wrap: wrap; }
  .fi-actions .btn { padding: 5px 9px; font-size: 12px; }
  .fi-icon { width: 32px; height: 32px; }
}
