* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: #f0f2f5;
  color: #1d2129;
  font-size: 14px;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #ff6b35 0%, #e55a2b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 4px;
}

.logo-icon {
  font-size: 32px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
}

.logo-sub {
  padding: 0 20px 24px;
  font-size: 12px;
  opacity: 0.8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.menu {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-item.active {
  background: rgba(255, 255, 255, 0.2);
  border-left: 3px solid #fff;
  padding-left: 17px;
  font-weight: 600;
}

.menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.admin-name {
  font-size: 14px;
  font-weight: 600;
}

.admin-role {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

/* 主内容区 */
.main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e5e6eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.data-tag {
  font-size: 12px;
  color: #86909c;
  background: #f2f3f5;
  padding: 6px 12px;
  border-radius: 12px;
}

.content {
  padding: 24px 32px;
  flex: 1;
}

/* 仪表盘 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.stat-icon.orange { background: #fff1e6; }
.stat-icon.blue { background: #e8f3ff; }
.stat-icon.green { background: #e8ffea; }
.stat-icon.gold { background: #fff7e6; }
.stat-icon.purple { background: #f5e8ff; }
.stat-icon.red { background: #ffece8; }

.stat-info {
  min-width: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1d2129;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: #86909c;
  margin-top: 4px;
}

.panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f2f3f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
}

.panel-body {
  padding: 16px 20px;
}

/* 表格 */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  background: #f7f8fa;
  font-size: 13px;
  color: #4e5969;
  font-weight: 600;
  border-bottom: 1px solid #e5e6eb;
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f2f3f5;
  font-size: 13px;
  color: #1d2129;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover {
  background: #fafbfc;
}

.table .avatar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.avatar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff1e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-gray { background: #f2f3f5; color: #4e5969; }
.badge-blue { background: #e8f3ff; color: #165dff; }
.badge-orange { background: #fff7e6; color: #ff7d00; }
.badge-green { background: #e8ffea; color: #00b42a; }
.badge-red { background: #ffece8; color: #f53f3f; }
.badge-gold { background: #fff4d6; color: #d48806; }
.badge-purple { background: #f5e8ff; color: #722ed1; }

/* 难度星星 */
.difficulty {
  color: #ffb300;
  letter-spacing: 1px;
}

.difficulty .off {
  color: #e5e6eb;
}

/* 搜索栏 */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  font-size: 14px;
  width: 240px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: #ff6b35;
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
  cursor: pointer;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #86909c;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* 进度条（用于家庭星星占比） */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #f2f3f5;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b35, #ffb300);
  border-radius: 4px;
}

/* 家庭卡片 */
.family-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.family-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.family-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.family-card-name {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-card-code {
  font-size: 12px;
  color: #86909c;
  background: #f2f3f5;
  padding: 4px 10px;
  border-radius: 8px;
}

.family-members {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.family-member {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f7f8fa;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}

/* 操作按钮 */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #e5e6eb;
  background: #fff;
  color: #4e5969;
  transition: all 0.2s;
}

.btn:hover {
  border-color: #ff6b35;
  color: #ff6b35;
}

.btn-primary {
  background: #ff6b35;
  color: #fff;
  border-color: #ff6b35;
}

.btn-primary:hover {
  background: #e55a2b;
  color: #fff;
}

.btn-danger {
  color: #f53f3f;
  border-color: #ffccc7;
}

.btn-danger:hover {
  background: #fff1f0;
  color: #f53f3f;
}

.btn-success {
  background: #00b42a;
  color: #fff;
  border-color: #00b42a;
}

/* 积分设置页 */
.page-desc {
  font-size: 14px;
  color: #86909c;
  margin-bottom: 16px;
}

.settings-card {
  background: #fff;
  border-radius: 8px;
  padding: 8px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid #f2f3f5;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-label {
  font-size: 15px;
  font-weight: 600;
  color: #1d2129;
}

.setting-desc {
  font-size: 13px;
  color: #86909c;
  margin-top: 4px;
}

.setting-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-input {
  width: 120px;
  padding: 8px 12px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.setting-input:focus {
  outline: none;
  border-color: #ff6b35;
}

.page-tip {
  margin-top: 16px;
  padding: 12px 16px;
  font-size: 13px;
  color: #8d6e00;
  background: #fff8e1;
  border-radius: 6px;
}

/* 真实数据标签 */
.data-tag-live {
  background: #e8ffea;
  color: #00b42a;
  border: 1px solid #aff0b5;
}

/* 登录页 */
.login-mask {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #fff1e8 0%, #f0f2f5 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(229, 90, 43, 0.12);
  padding: 40px 32px 32px;
  display: flex;
  flex-direction: column;
}

.login-logo {
  font-size: 56px;
  text-align: center;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #ff6b35;
  text-align: center;
  margin-top: 12px;
}

.login-sub {
  font-size: 13px;
  color: #86909c;
  text-align: center;
  margin: 6px 0 28px;
}

.login-input {
  height: 44px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: #ff6b35;
}

.login-btn {
  height: 46px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff6b35 0%, #e55a2b 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.login-btn:hover { opacity: 0.92; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  color: #f53f3f;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .logo-text, .logo-sub, .menu-item span:not(.menu-icon), .admin-name, .admin-role {
    display: none;
  }
  .main {
    margin-left: 60px;
  }
}
