/* ===== 全局 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #177cb1;
  --primary-dark: #0d47a1;
  --primary-light: #e3f2fd;
  --accent: #f57d09;
  --danger: #e74c3c;
  --success: #27ae60;
  --bg: #eef3f8;
  --card-bg: #fff;
  --text: #1a2c3e;
  --text-light: #5a6e7c;
  --border: #e2edf6;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

/* ===== 顶部导航 ===== */
.topbar {
  background: linear-gradient(135deg, #0d47a1, #177cb1);
  color: #fff;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(13,71,161,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
}
.topbar-brand .logo {
  height: 60px;
  width: auto;
  object-fit: contain;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.topbar-user .role-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  font-weight: 600;
}
.topbar-user .role-badge.master { background: rgba(245,125,9,0.3); }
.topbar-user .role-badge.sub { background: rgba(255,255,255,0.15); }
.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }
/* 语言切换（简/繁）*/
.locale-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  overflow: hidden;
}
.loc-btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.85);
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.loc-btn + .loc-btn { border-left: 1px solid rgba(255,255,255,0.25); }
.loc-btn:hover { background: rgba(255,255,255,0.2); }
.loc-btn.active { background: #fff; color: #177cb1; }
.topbar-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  font-size: 14px;
  padding: 7px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.22); color: #fff; box-shadow: inset 0 -2px 0 0 rgba(255,255,255,0.8); }

/* ===== 容器 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d8e8f4;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23,124,177,0.1);
}

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead {
  background: linear-gradient(135deg, #1565c0, #1976d2);
  color: #fff;
}
.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) { background: #f8fbfe; }
.data-table tbody tr:hover { background: #eef4fc; }
.data-table .tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.tag-master { background: #fff3e0; color: #e67e22; }
.tag-sub { background: #e3f2fd; color: #1565c0; }
.tag-e1 { background: #fdecea; color: #e74c3c; }
.tag-e2 { background: #fff3e0; color: #f57d09; }
.tag-e3 { background: #e8f5e9; color: #27ae60; }

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; }
.modal-box {
  background: #fff;
  max-width: 560px;
  width: 90%;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  padding: 28px 32px;
  margin-bottom: 40px;
}
.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 20px;
}
.modal-close {
  float: right;
  cursor: pointer;
  font-size: 22px;
  color: #999;
  line-height: 1;
}
.modal-close:hover { color: #333; }

/* ===== 文件预览弹窗 ===== */
#previewModal .modal-box { padding: 0; }
#previewFrame { width: 100%; height: 100%; border: none; background: #fff; }

/* ===== Toast 轻提示 ===== */
.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.85); color: #fff;
  padding: 12px 22px; border-radius: 10px; font-size: 14px;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: all .3s ease; max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #e74c3c; }
.toast.success { background: #2ecc71; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 15px; }

/* ===== 提示 ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-success { background: #e8f5e9; color: #1b7a3e; border: 1px solid #c3e6cb; }
.alert-info { background: #e3f2fd; color: #0d47a1; border: 1px solid #b3d9f2; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.stat-card .stat-info .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-dark);
}
.stat-card .stat-info .label {
  font-size: 13px;
  color: var(--text-light);
}

/* ===== 搜索 ===== */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.search-bar .form-input { max-width: 280px; }

/* ===== 标签页 ===== */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.tab {
  padding: 10px 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab:hover { color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-brand { font-size: 15px; }
  .card { padding: 16px; }
}
