* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  overflow: hidden;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.topbar h1 { font-size: 20px; margin: 0; }
.tabs { display: flex; gap: 8px; }
.tab {
  padding: 8px 20px; font-size: 14px; cursor: pointer;
  background: #fff; border: 1px solid #d1d5db; border-radius: 0;
}
.tab.active { background: #c62828; color: #fff; border-color: #c62828; }

.panel { margin-top: 16px; }
.search-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; margin-top: 12px; }
.hidden { display: none; }

/* 筛选 */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #fff; padding: 12px; border: 1px solid #e5e7eb; border-radius: 0;
  flex-shrink: 0;
}
.filters select, .filters input, .sync-controls select, .sync-controls input {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 0; font-size: 13px;
  background: #fff;
}
.filters input[type="text"] { flex: 1; min-width: 200px; }
.primary {
  padding: 8px 20px; background: #c62828; color: #fff; border: 0; border-radius: 0;
  cursor: pointer; font-size: 14px;
}
.primary:hover { background: #b02828; }

.result-meta { padding: 10px 2px; font-size: 13px; color: #6b7280; display: flex; align-items: center; justify-content: space-between; }

.chk-col { width: 34px; padding: 0 8px !important; }
.chk-col input, td input[type="checkbox"] { cursor: pointer; }
td.chk-cell { width: 34px; text-align: center; }

.table-wrap { background: #fff; border: 1px solid #e5e7eb; overflow: auto; flex: 1; min-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; background: #f9fafb; font-weight: 600;
  border-bottom: 1px solid #e5e7eb; position: sticky; top: 0;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #f0f1f3; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fef2f2; }
td.title { font-weight: 500; }
td.mono { font-family: SFMono-Regular, Consolas, monospace; font-size: 12px; color: #6b7280; }

.badge { padding: 2px 8px; font-size: 12px; border-radius: 2px; white-space: nowrap; }
.badge.running { background: #fff7e6; color: #b45309; }
.badge.completed { background: #e6f4ea; color: #1e7e34; }
.badge.terminated { background: #f3f4f6; color: #6b7280; }

.pager { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.pager button { padding: 6px 14px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; border-radius: 0; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pg-info { font-size: 13px; color: #6b7280; }

/* 同步 */
.sync-controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #fff; padding: 12px; border: 1px solid #e5e7eb;
}
.hint { font-size: 12px; color: #9ca3af; }
.sync-status { margin-top: 12px; font-size: 14px; font-weight: 500; }
.sync-progress { margin-top: 10px; }
.bar { height: 8px; background: #e5e7eb; border-radius: 0; overflow: hidden; }
.fill { height: 100%; background: #c62828; transition: width 0.4s; }
.sync-nums { margin-top: 6px; font-size: 13px; color: #6b7280; }
.sync-log {
  margin-top: 12px; background: #1f2937; color: #d1d5db; padding: 12px;
  font-size: 12px; font-family: SFMono-Regular, Consolas, monospace;
  max-height: 400px; overflow-y: auto; border-radius: 0; white-space: pre-wrap;
}

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-body {
  background: #fff; width: 720px; max-width: 100%; max-height: 90vh;
  overflow-y: auto; border-radius: 0;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-head h2 { margin: 0 0 8px; font-size: 17px; }
.m-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #6b7280; }
.close { border: 0; background: none; font-size: 24px; cursor: pointer; color: #9ca3af; }
.m-section { padding: 12px 20px; }
.m-section h3 { font-size: 14px; margin: 0 0 10px; color: #374151; }
.field { display: flex; padding: 7px 0; border-bottom: 1px solid #f0f1f3; }
.f-label { width: 160px; flex-shrink: 0; color: #6b7280; font-size: 13px; }
.f-val { flex: 1; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.flow-item { display: flex; gap: 12px; padding: 8px 0; }
.flow-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #c62828;
  margin-top: 5px; flex-shrink: 0;
}
.flow-top { display: flex; justify-content: space-between; font-size: 13px; }
.flow-top span { color: #9ca3af; font-size: 12px; }
.flow-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }
.flow-remark { font-size: 12px; color: #374151; background: #f9fafb; padding: 6px 8px; margin-top: 4px; }
.empty { color: #9ca3af; font-size: 13px; padding: 8px 0; }
.attach { color: #1e6fd9; text-decoration: none; display: inline-block; margin: 2px 0; }
.attach:hover { text-decoration: underline; }
.attach .fsize { color: #9ca3af; font-size: 12px; }
.fimg-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.fimg { width: 80px; height: 80px; object-fit: cover; cursor: pointer; border: 1px solid #e5e7eb; border-radius: 2px; }
.fimg:hover { border-color: #c62828; }

/* 右侧抽屉（审批详情） */
.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer.hidden { display: none; }
.drawer-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 86%; max-width: 1280px;
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  animation: drawerIn 0.25s ease;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-resizer {
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  cursor: col-resize; z-index: 10;
}
.drawer-resizer:hover { background: #c62828; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
  background: #fafafa;
}
.drawer-title { font-size: 14px; font-weight: 600; color: #6b7280; }
.drawer-head .close { font-size: 26px; }
.drawer-panel iframe { flex: 1; border: 0; width: 100%; }

@media (max-width: 600px) {
  .filters { position: static; }
  .field { flex-direction: column; }
  .f-label { width: auto; }
  .topbar h1 { font-size: 17px; }
  .drawer-panel { width: 100%; }
}