/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #1d2129;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }

/* ========== 导航栏 ========== */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e6eb;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: #1d2129;
}
.nav-home-link {
  font-size: 13px;
  color: #165dff;
  margin-left: 16px;
  transition: opacity 0.2s;
}
.nav-home-link:hover {
  opacity: 0.75;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  font-size: 14px;
  color: #4e5969;
  transition: color 0.2s;
}
.nav-link:hover { color: #165dff; }
.nav-user {
  font-size: 14px;
  color: #86909c;
}
.nav-btn {
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  color: #4e5969;
  transition: all 0.2s;
  background: #fff;
}
.nav-btn:hover {
  border-color: #165dff;
  color: #165dff;
}

/* ========== 主内容区 ========== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  width: 100%;
}

/* ========== Flash 消息 ========== */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash-success { background: #e8ffea; color: #00b42a; border-color: #a7f3b0; }
.flash-error   { background: #ffece8; color: #f53f3f; border-color: #ffb4b4; }
.flash-info    { background: #e8f3ff; color: #165dff; border-color: #bEDAFF; }

/* ========== 按钮 ========== */
.btn-primary {
  display: inline-block;
  padding: 10px 24px;
  background: #165dff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: #0e42d2; }
.btn-block { width: 100%; }

.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: #fff;
  color: #4e5969;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: #165dff; color: #165dff; }

.btn-link {
  background: none;
  border: none;
  color: #165dff;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}
.btn-link:hover { background: #e8f3ff; }
.btn-danger { color: #f53f3f; }
.btn-danger:hover { background: #ffece8; }

/* ========== 表单 ========== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 13px;
  color: #4e5969;
  font-weight: 500;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  font-size: 14px;
  color: #1d2129;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #165dff;
  box-shadow: 0 0 0 3px rgba(22,93,255,0.1);
}
.form-group input::placeholder { color: #c9cdd4; }

/* ========== 登录页 ========== */
.login-wrapper {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
}
.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-header p {
  font-size: 14px;
  color: #86909c;
}
.login-form { margin-bottom: 24px; }
.login-footer {
  text-align: center;
  font-size: 12px;
  color: #86909c;
  line-height: 1.8;
}
.login-tip { color: #c9cdd4; }

/* ========== 仪表盘 ========== */
.dashboard-header {
  margin-bottom: 24px;
}
.dashboard-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dashboard-header p {
  font-size: 14px;
  color: #86909c;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.tool-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid #e5e6eb;
  transition: all 0.2s;
  cursor: pointer;
}
.tool-card:hover {
  border-color: #165dff;
  box-shadow: 0 4px 16px rgba(22,93,255,0.12);
  transform: translateY(-2px);
}
.tool-icon {
  font-size: 36px;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
  border-radius: 12px;
}
.tool-info { flex: 1; min-width: 0; }
.tool-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1d2129;
}
.tool-info p {
  font-size: 13px;
  color: #86909c;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-arrow {
  font-size: 20px;
  color: #c9cdd4;
  flex-shrink: 0;
  align-self: center;
  transition: transform 0.2s, color 0.2s;
}
.tool-card:hover .tool-arrow {
  color: #165dff;
  transform: translateX(4px);
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e6eb;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  color: #86909c;
}

/* ========== 管理员页面 ========== */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.admin-header p {
  font-size: 14px;
  color: #86909c;
}
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid #e5e6eb;
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #4e5969;
  margin-bottom: 16px;
}

/* 创建用户表单 */
.create-user-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}
.create-user-form .form-group { margin-bottom: 0; }
.form-group-btn { display: flex; align-items: flex-end; }
@media (max-width: 768px) {
  .create-user-form .form-row { grid-template-columns: 1fr; }
}

/* 数据表格 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid #f2f3f5;
  border-radius: 8px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead {
  background: #f7f8fa;
}
.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f2f3f5;
}
.data-table th {
  font-weight: 600;
  color: #4e5969;
  font-size: 12px;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f7f8fa; }
.data-table .actions {
  display: flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}
.inline-form { display: inline; }

/* 徽章 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-admin { background: #fff7e8; color: #ff7d00; }
.badge-user  { background: #e8f3ff; color: #165dff; }
.badge-active { background: #e8ffea; color: #00b42a; }
.badge-disabled { background: #f2f3f5; color: #86909c; }

.text-muted { color: #86909c; }

/* 权限设置页 */
.tool-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.tool-check-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #e5e6eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.tool-check-item:hover {
  border-color: #165dff;
  background: #f7faff;
}
.tool-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #165dff;
  flex-shrink: 0;
}
.check-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
  border-radius: 10px;
  flex-shrink: 0;
}
.check-info { flex: 1; }
.check-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.check-info small {
  font-size: 12px;
  color: #86909c;
}
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ========== 工具页面通用 ========== */
.tool-page-header {
  margin-bottom: 16px;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #4e5969;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  transition: all 0.2s;
}
.btn-back:hover {
  border-color: #165dff;
  color: #165dff;
}

/* ========== 底部 Footer ========== */
.site-footer {
  background: #f0f2f5;
  padding: 20px 16px;
  margin-top: 24px;
  text-align: center;
  border-top: 1px solid #e5e6eb;
}
.site-footer .footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.site-footer .footer-link {
  font-size: 12px;
  color: #86909c;
  text-decoration: none;
  line-height: 1.6;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.site-footer a.footer-link {
  color: #86909c;
}
.site-footer .footer-link-blue,
.site-footer a.footer-link-blue {
  color: #165dff;
}
.site-footer a.footer-link-blue:hover {
  color: #0e42d2;
  text-decoration: underline;
}
.site-footer a.footer-link:hover {
  color: #165dff;
  text-decoration: underline;
}
.site-footer .beian-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
}
