/* 保圣文件管理系统 - 全局样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  background: #1f2d3d;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.userinfo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.who { color: #cfd8e3; }
.capwrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cap { font-size: 12px; color: #cfd8e3; }
.cap b { color: #ffd666; }
.capbar { width: 180px; height: 8px; background: #39485b; border-radius: 4px; overflow: hidden; }
.capfill { height: 100%; background: linear-gradient(90deg, #52c41a, #ffd666, #ff7875); transition: width .4s; }

/* ---------- 导航 ---------- */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e4e7ed;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.navbar a {
  display: inline-block;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.navbar a:hover { color: #1f6fb2; }
.navbar a.active { color: #1f6fb2; border-bottom-color: #1f6fb2; }

/* ---------- 布局 ---------- */
.container {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}
.footer {
  text-align: center;
  color: #999;
  padding: 16px;
  font-size: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-item label { display: block; margin-bottom: 6px; color: #555; font-size: 13px; }
.form-item label .req { color: #f5222d; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  color: #333;
}
input:focus, select:focus, textarea:focus { border-color: #1f6fb2; outline: none; box-shadow: 0 0 0 2px rgba(31,111,178,.15); }
input[readonly], input:disabled { background: #f5f5f5; color: #999; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid #1f6fb2;
  background: #1f6fb2;
  color: #fff;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: #185a94; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-ghost { background: #fff; color: #1f6fb2; border-color: #1f6fb2; }
.btn-ghost:hover { background: #f0f7ff; }
.btn-danger { background: #fff; color: #f5222d; border-color: #f5222d; }
.btn-danger:hover { background: #fff1f0; }
.btn-danger-solid { background: #f5222d; color: #fff; border-color: #f5222d; }
.btn-danger-solid:hover { background: #d32029; }
.btn-success { background: #52c41a; border-color: #52c41a; }
.btn-success:hover { background: #45a016; }
.btn-warn { background: #fa8c16; border-color: #fa8c16; }
.btn-warn:hover { background: #d46b08; }

/* ---------- 提示条 ---------- */
.toast {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  transition: opacity .3s;
}
.toast.ok { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.toast.err { background: #fff2f0; border: 1px solid #ffa39e; color: #cf1322; }

/* ---------- 搜索栏 ---------- */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.searchbar .search-input {
  position: relative;
  flex: 1;
  max-width: 380px;
}
.searchbar .search-input svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa4af;
  pointer-events: none;
}
.searchbar .search-input input {
  height: 38px;
  padding-left: 36px;
  border-radius: 6px;
  background: #fafbfc;
}
.searchbar .search-input input:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31,111,178,.12);
}
.searchbar .btn {
  height: 38px;
  border-radius: 6px;
  padding-left: 20px;
  padding-right: 20px;
}

/* ---------- 拖拽上传 ---------- */
.uploadbar .up-opts {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.dropzone {
  border: 2px dashed #b9cfe6;
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  color: #6b7a8d;
  background: #f8fbff;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}
.dropzone:hover { border-color: #1f6fb2; }
.dropzone.drag { border-color: #1f6fb2; background: #eef6ff; color: #1f6fb2; }
.dropzone .dz-icon { font-size: 26px; line-height: 1; margin-bottom: 6px; }
.dropzone .dz-text { font-size: 14px; }
.dropzone .dz-link { color: #1f6fb2; text-decoration: underline; }
.dz-status { margin-top: 8px; font-size: 13px; color: #999; word-break: break-all; }
.dz-status.on { color: #389e0d; font-weight: 600; }

/* ---------- 批量操作栏 ---------- */
.batchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #f6f9ff;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.batchbar .batch-info { font-size: 14px; color: #1f6fb2; font-weight: 600; }
.batchbar .batch-hint { font-size: 12px; color: #999; }
.batchbar .btn[disabled] { opacity: .45; cursor: not-allowed; }
th.chk, td.chk { width: 34px; text-align: center; }
th.chk input, td.chk input { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }

/* ---------- 在线预览 ---------- */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.preview-title .fname { font-size: 16px; font-weight: 600; word-break: break-all; }
.preview-actions { display: flex; gap: 8px; flex-shrink: 0; }
.preview-body {
  margin-top: 14px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
}
.preview-image { padding: 20px; text-align: center; background: #f7f8fa; }
.preview-image img { max-width: 100%; max-height: 75vh; display: inline-block; box-shadow: 0 2px 10px rgba(0,0,0,.12); border-radius: 4px; background: #fff; }
.preview-pdf iframe { width: 100%; height: 78vh; border: 0; background: #525659; display: block; }
.preview-media { padding: 24px; background: #f7f8fa; text-align: center; }
.preview-media audio, .preview-media video { max-width: 100%; }
.preview-media video { max-height: 70vh; border-radius: 6px; background: #000; }
.preview-note {
  padding: 8px 14px;
  margin: 0;
  background: #e6f4ff;
  color: #0958d9;
  font-size: 13px;
  border-bottom: 1px solid #bae0ff;
}
.codeview {
  margin: 0;
  padding: 16px 18px;
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  background: #fafbfc;
  color: #333;
  overflow-x: auto;
}
.tablewrap { overflow-x: auto; }
.table.sheet td {
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table.sheet td.th {
  background: #f0f5fa;
  font-weight: 600;
  white-space: normal;
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: middle; }
.table th { background: #fafafa; color: #555; font-weight: 600; white-space: nowrap; }
.table tr:hover td { background: #fafcff; }
.table .num { color: #888; font-size: 13px; }
.table .actions { white-space: nowrap; }
.table .actions a, .table .actions button { margin-right: 6px; }

/* ---------- 文件浏览 ---------- */
.locbar {
  background: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.locbar .path { font-size: 14px; }
.locbar .path a { color: #1f6fb2; text-decoration: none; }
.locbar .path a:hover { text-decoration: underline; }
.locbar .perm { margin-left: auto; font-size: 12px; padding: 3px 10px; border-radius: 10px; }
.perm.own { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.perm.readonly { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }

.uploadbar {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.uploadbar input[type=file] { flex: 1; min-width: 240px; }
.fileicon { font-size: 16px; }
.fname a { color: #1f6fb2; text-decoration: none; }
.fname a:hover { text-decoration: underline; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat .v { font-size: 26px; font-weight: 700; color: #1f6fb2; }
.stat .k { color: #888; font-size: 13px; margin-top: 4px; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 11px; border: 1px solid #d9d9d9; border-radius: 4px;
  text-decoration: none; color: #333; background: #fff; font-size: 13px;
}
.pager a:hover { border-color: #1f6fb2; color: #1f6fb2; }
.pager .cur { background: #1f6fb2; color: #fff; border-color: #1f6fb2; }
.pager .info { color: #888; }

/* ---------- 登录页 ---------- */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2d3d 0%, #2c4a6b 100%);
  min-height: 100vh;
}
.login-box {
  background: #fff; border-radius: 10px; padding: 36px 40px; width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-box h1 { font-size: 20px; text-align: center; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }
.login-box .form-item { margin-bottom: 16px; }
.login-box .btn { width: 100%; padding: 10px; font-size: 15px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 8px; padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .form-item { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- 空态 ---------- */
.empty { text-align: center; color: #aaa; padding: 30px 0; }
