/* ============================================================
   tables.css — 数据表、排序、分页、批量选择
   ============================================================ */

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  max-height: calc(100vh - 300px);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .02em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--text); }
thead th .sort-ind {
  display: inline-block;
  margin-left: 4px;
  opacity: .35;
  font-size: 9px;
  transition: var(--transition);
}
thead th.sorted { color: var(--accent); }
thead th.sorted .sort-ind { opacity: 1; }

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  line-height: 1.55;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }

td.cell-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  width: 1%;
}
td.cell-q {
  min-width: 240px;
  max-width: 460px;
  word-break: break-word;
}
td.cell-a {
  min-width: 120px;
  max-width: 260px;
  word-break: break-word;
  color: var(--ok);
  font-family: var(--mono);
  font-size: 12px;
}
td.cell-opts {
  max-width: 200px;
  color: var(--text-faint);
  font-size: 12px;
  word-break: break-word;
}
td.cell-type, td.cell-src { width: 1%; white-space: nowrap; }
td.cell-time {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  width: 1%;
}
td.cell-act { width: 1%; white-space: nowrap; }
td.cell-act .btn { margin-right: 4px; }
td.cell-act .btn:last-child { margin-right: 0; }

th.cb, td.cb { width: 1%; padding-right: 0; }
th.cb input, td.cb input { accent-color: var(--accent); cursor: pointer; width: 14px; height: 14px; }

/* 行内编辑 */
td.inline-edit {
  padding: 4px 6px;
}
td.inline-edit input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--mono);
  background: var(--surface-3);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  outline: none;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 52px 20px;
  text-align: center;
  color: var(--text-faint);
}
.empty-state svg { width: 38px; height: 38px; opacity: .3; }
.empty-state .title { font-size: 14px; color: var(--text-dim); }
.empty-state .hint { font-size: 12.5px; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.pager .info {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  min-width: 108px;
  text-align: center;
}
.pager .page-btn {
  min-width: 30px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--mono);
}
.pager .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pager .size-select { width: auto; min-width: 96px; padding: 5px 8px; font-size: 12px; }

/* 批量操作条 */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.bulk-bar .count { font-family: var(--mono); font-weight: 600; color: var(--accent); }
