/* 飞书风格基础样式 —— 变量取自 Universe Design 设计语言
   品牌色 #1456F0、中性 #1F2329/#646A73/#8F959E/#BBBFC4、描边 #DEE0E3/#D0D3D6、背景 #F5F6F7
   圆角 XS 4 / S 6 / M 8 / L 10，间距按 8px 栅格 */

:root {
  --brand: #1456f0;
  --brand-hover: #0e42c8;
  --brand-light: #e1eaff;

  --text-1: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --text-4: #bbbfc4;

  --bg-page: #f5f6f7;
  --bg-hover: #eff0f1;
  --bg-sub: #f8f9fa;
  --white: #fff;

  --border: #dee0e3;
  --border-input: #d0d3d6;
  --divider: #eff0f1;

  --success: #34c724;
  --warning: #ff8800;
  --danger: #f54a45;

  --radius-xs: 4px;
  --radius-s: 6px;
  --radius-m: 8px;
  --radius-l: 10px;

  --shadow-s1: 0 1px 2px -2px rgba(31, 35, 41, 0.02), 0 2px 4px 0 rgba(31, 35, 41, 0.02);
  --shadow-s2: 0 2px 6px -4px rgba(31, 35, 41, 0.05), 0 4px 8px 0 rgba(31, 35, 41, 0.03);

  --header-h: 56px;
  --nav-w: 232px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

/* ---------- 布局 ---------- */
.app-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-s);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }

.header-search {
  margin-left: 24px;
  width: 260px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.app-body { display: flex; align-items: flex-start; min-height: calc(100vh - var(--header-h)); }

.side-nav {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--white);
  border-right: 1px solid var(--divider);
  padding: 12px 8px 24px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.nav-group-title {
  padding: 12px 12px 4px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  color: var(--text-1);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.is-active { background: var(--brand-light); color: var(--brand); font-weight: 500; }
.nav-item.is-disabled { color: var(--text-4); cursor: default; }
.nav-item.is-disabled:hover { background: transparent; }

.nav-icon { width: 16px; height: 16px; flex: 0 0 16px; opacity: 0.9; }

.nav-tag {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 4px;
  line-height: 16px;
}

.main { flex: 1 1 auto; min-width: 0; padding: 20px 24px 40px; }

.page-head { margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 600; line-height: 1.4; margin: 0; }
.page-desc { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-s1);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--divider);
}

.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

.filter-label { color: var(--text-2); font-size: 13px; margin-right: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-input);
  background: var(--white);
  color: var(--text-1);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-text {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding: 0 8px;
}
.btn-text:hover { background: var(--brand-light); }
.btn-danger-text { color: var(--danger); border-color: transparent; background: transparent; padding: 0 8px; }
.btn-danger-text:hover { background: #fdeceb; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { color: var(--text-4); border-color: var(--border); background: var(--bg-sub); cursor: not-allowed; }

/* ---------- 输入 ---------- */
.input, .select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-s);
  background: var(--white);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-1);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--text-4); }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(20, 86, 240, 0.12); }
.input-search { width: 220px; }
.select { padding-right: 26px; cursor: pointer; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.tag-brand { background: var(--brand-light); color: var(--brand); }
.tag-success { background: #e8f8e5; color: #2a9e1c; }
.tag-warning { background: #fff3e3; color: #d96b00; }
.tag-danger { background: #fdeceb; color: #d8352f; }
.tag-neutral { background: var(--bg-hover); color: var(--text-2); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }
.table thead th {
  height: 40px;
  padding: 0 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-sub);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody td {
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-1);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--bg-sub); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .cell-sub { display: block; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.table .cell-strong { font-weight: 500; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-2);
}
.pager-total { margin-right: auto; color: var(--text-3); }
.pager-item {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  cursor: pointer;
}
.pager-item:hover { background: var(--bg-hover); }
.pager-item.is-current { border-color: var(--brand); color: var(--brand); background: var(--white); }
.pager-item.is-disabled { color: var(--text-4); cursor: not-allowed; }

/* ---------- 空状态 ---------- */
.empty {
  padding: 56px 0;
  text-align: center;
  color: var(--text-3);
}
.empty-title { color: var(--text-2); margin-bottom: 4px; }

/* ---------- 统计条 ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--white);
  border: 1px solid var(--divider);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  box-shadow: var(--shadow-s1);
}
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value { font-size: 22px; font-weight: 600; line-height: 1.3; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 12px; color: var(--text-2); margin-left: 2px; font-weight: 400; }

/* ---------- 响应式：S / XS 断点 ---------- */
@media (max-width: 1023px) {
  .side-nav { display: none; }
  .main { padding: 16px; overflow-x: hidden; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-search { display: none; }
  /* 窄屏保列宽，宁可横向滚动，也不把中文挤成竖排 */
  html, body { max-width: 100%; overflow-x: hidden; }
  .card { max-width: 100%; }
  .table { min-width: 720px; }
  .table thead th,
  .table tbody td { white-space: nowrap; }
}

@media (max-width: 599px) {
  .app-header { padding: 0 12px; gap: 8px; }
  .main { padding: 12px; }
  .toolbar { padding: 12px; }
  .filter-label { display: none; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .toolbar .input { flex: 1 1 100%; width: auto !important; box-sizing: border-box; }
  .toolbar .btn { flex: 0 0 auto; }
  .table tbody td { height: 52px; }          /* XS 断点表格转宽松型，触控区域加大 */
  .table thead th { height: 44px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-title { font-size: 18px; }
  .toolbar-right { width: 100%; margin-left: 0; }
  .toolbar-right .btn { flex: 1; justify-content: center; }
}
