/* ============================================================
   狐糯糯管家 v9.9.9 - 全新视觉设计系统
   配色方案：紫色科技风 + 玻璃态卡片
   ============================================================ */

/* ========== 全局变量 ========== */
:root {
  /* 主色 */
  --primary: #7C3AED;
  --primary-light: #A78BFA;
  --primary-dark: #6D28D9;
  --primary-gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 50%, #A78BFA 100%);

  /* 背景 */
  --bg: #F8FAFC;
  --bg-elevated: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;

  /* 文字 */
  --text: #0F172A;
  --text-secondary: #475569;
  --text-light: #94A3B8;
  --text-inverse: #FFFFFF;

  /* 功能色 */
  --success: #10B981;
  --success-bg: #D1FAE5;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --danger: #EF4444;
  --danger-bg: #FEE2E2;
  --info: #3B82F6;
  --info-bg: #DBEAFE;

  /* 边框与阴影 */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.06), 0 12px 24px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 8px 16px rgba(15, 23, 42, 0.1), 0 24px 48px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  /* 间距 */
  --page-padding: 16px;
  --section-gap: 12px;
  --card-gap: 10px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* ========== 全局重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ========== 表单元素重置 ========== */
input, button, select, textarea {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"] {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  background: var(--bg);
  color: var(--text);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08);
}

input::placeholder {
  color: var(--text-light);
}

button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

button[type="submit"]:active {
  transform: scale(0.98);
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #7c3aed 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, rgba(167, 139, 250, 0.08) 0%, transparent 40%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, 2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 40px 32px 32px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1) inset;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--primary-gradient);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.login-logo svg {
  width: 32px;
  height: 32px;
  color: white;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.login-header .version {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

.login-form .field,
.field {
  margin-bottom: 16px;
}

.login-form label,
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-form label .hint,
.field > label .hint {
  font-weight: 400;
  color: var(--text-light);
  font-size: 12px;
}

.login-form input,
.field > input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  background: var(--bg);
  color: var(--text);
}

.login-form input:focus,
.field > input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08);
}

.login-form input::placeholder,
.field > input::placeholder {
  color: var(--text-light);
}

.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.login-links a {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.login-links a:hover {
  opacity: 0.8;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-light);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 20px;
}

/* ========== App 主容器 ========== */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-header {
  background: var(--primary-gradient);
  color: white;
  padding: 12px var(--page-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title svg {
  width: 24px;
  height: 24px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.role-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.super_admin {
  background: rgba(255, 215, 0, 0.25);
  color: #FFD700;
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.role-badge.admin {
  background: rgba(59, 130, 246, 0.25);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-badge.user {
  background: rgba(16, 185, 129, 0.25);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.app-content {
  flex: 1;
  padding: var(--section-gap) 0 calc(var(--section-gap) + 70px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== 底部导航 ========== */
.app-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-light);
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

.tab-label {
  font-size: 11px;
  font-weight: 500;
}

/* ========== 页面通用 ========== */
.page {
  padding: 0 var(--page-padding);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 8px 0;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  background: var(--surface-hover);
}

/* ========== Dashboard 卡片 ========== */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
  margin-bottom: var(--section-gap);
}

.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.dash-card:hover {
  transform: translateY(-2px);
}

.dash-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-info {
  flex: 1;
  min-width: 0;
}

.dash-label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.dash-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.dash-value.online {
  color: var(--success);
}

.dash-value.offline {
  color: var(--danger);
}

/* ========== 群列表 ========== */
.group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.group-card:hover {
  box-shadow: var(--shadow);
  transform: translateX(4px);
}

.group-card.exited {
  opacity: 0.6;
}

.group-card.selected {
  border: 2px solid var(--primary);
  background: rgba(124, 58, 237, 0.03);
}

.group-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.group-icon-wrap svg {
  width: 22px;
  height: 22px;
  color: white;
}

.group-info {
  flex: 1;
  min-width: 0;
}

.group-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-meta {
  font-size: 12px;
  color: var(--text-light);
}

.exit-tag {
  display: inline-block;
  padding: 2px 6px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 11px;
  border-radius: 4px;
  margin-left: 6px;
}

.group-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.group-tag-chip {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.perm-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
}

.perm-badge.edit {
  background: var(--success-bg);
  color: var(--success);
}

.perm-badge.view {
  background: var(--info-bg);
  color: var(--info);
}

.group-arrow {
  color: var(--text-light);
  flex-shrink: 0;
}

/* ========== 功能列表 ========== */
.function-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.function-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.function-item:hover {
  box-shadow: var(--shadow);
}

.function-item.readonly {
  opacity: 0.7;
}

.function-item.exited {
  opacity: 0.5;
}

.function-info {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.function-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.function-icon-wrap svg {
  width: 20px;
  height: 20px;
  color: white;
}

.function-text {
  flex: 1;
  min-width: 0;
}

.function-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.function-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.function-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.func-category {
  padding: 2px 8px;
  background: var(--border-light);
  color: var(--text-secondary);
  font-size: 11px;
  border-radius: 4px;
}

.func-updated {
  font-size: 11px;
  color: var(--text-light);
}

/* ========== Switch 开关 ========== */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .3s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 按钮 ========== */
.btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-main:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-main:active {
  transform: scale(0.98);
}

.btn-main.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--surface-hover);
  border-color: var(--primary-light);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--border-light);
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer button {
  flex: 1;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
  background: white;
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.toggle-btn.active {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.08);
  color: var(--primary);
  font-weight: 600;
}

/* ========== 成员列表 ========== */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.user-card:hover {
  box-shadow: var(--shadow);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-info-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lock-tag {
  font-size: 11px;
  color: var(--warning);
}

.user-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.role-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.role-tag.super {
  background: rgba(255, 215, 0, 0.15);
  color: #B45309;
}

.role-tag.admin {
  background: rgba(59, 130, 246, 0.15);
  color: #2563EB;
}

.role-tag.user {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.user-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.role-actions {
  display: flex;
  gap: 2px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--primary-light);
  color: white;
}

/* ========== 标签筛选 ========== */
.tag-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tag-filter-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.tag-filter-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag-chip:hover {
  opacity: 0.8;
}

.tag-chip.clear {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ========== 批量工具栏 ========== */
.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.batch-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--warning);
}

.btn-batch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-batch-cancel {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 8px;
}

.batch-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.batch-check.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ========== 日志 ========== */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.log-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.log-time {
  font-size: 12px;
  color: var(--text-light);
}

.log-body {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.log-user {
  font-weight: 600;
  color: var(--text);
}

.log-role {
  font-size: 12px;
  color: var(--text-light);
}

.log-target {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.log-diff {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 8px;
}

.diff-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}

.diff-label {
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.diff-before {
  color: var(--danger);
}

.diff-after {
  color: var(--success);
}

/* ========== 个人中心 ========== */
.profile-page {
  padding: 0;
}

.profile-header {
  background: var(--primary-gradient);
  color: white;
  padding: 32px var(--page-padding);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 12px;
  position: relative;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  position: relative;
}

.profile-role {
  font-size: 13px;
  opacity: 0.8;
  position: relative;
}

.profile-menu {
  padding: 16px var(--page-padding);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.menu-item:hover {
  box-shadow: var(--shadow);
  transform: translateX(4px);
}

.menu-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.menu-label svg {
  width: 20px;
  height: 20px;
  color: var(--text-light);
}

.menu-arrow {
  color: var(--text-light);
}

/* ========== 工具页 ========== */
.tools-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.tools-tab {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.tools-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: var(--radius-sm);
  z-index: 0;
}

.tools-tab:hover {
  color: var(--primary);
  background: rgba(124, 58, 237, 0.06);
}

.tools-tab.active {
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.tools-tab.active::before {
  opacity: 1;
}

.tools-tab span {
  position: relative;
  z-index: 1;
}

.tools-content {
  min-height: 200px;
}

/* ========== 模板/标签/公告卡片 ========== */
.template-card,
.schedule-card,
.tag-card,
.announcement-card,
.bot-card,
.sw-item,
.alias-item,
.allowlist-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.template-card:hover,
.schedule-card:hover,
.tag-card:hover,
.announcement-card:hover,
.bot-card:hover,
.sw-item:hover,
.alias-item:hover,
.allowlist-item:hover {
  box-shadow: var(--shadow);
}

.template-info,
.schedule-info,
.bot-info {
  flex: 1;
  min-width: 0;
}

.template-name,
.schedule-name,
.bot-name,
.announcement-title,
.sw-word,
.alias-func {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.template-desc,
.schedule-meta,
.bot-meta,
.announcement-meta,
.alias-name,
.allowlist-note {
  font-size: 13px;
  color: var(--text-secondary);
}

.template-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.default-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  border-radius: 4px;
  margin-left: 6px;
}

.schedule-status {
  font-size: 12px;
  margin-top: 4px;
}

.tag-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-name {
  font-size: 15px;
  font-weight: 500;
}

.tag-count {
  font-size: 12px;
  color: var(--text-light);
}

.sw-action {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}

.sw-action.warn {
  background: var(--warning-bg);
  color: var(--warning);
}

.sw-action.mute {
  background: var(--info-bg);
  color: var(--info);
}

.sw-action.kick {
  background: var(--danger-bg);
  color: var(--danger);
}

.sw-regex {
  padding: 2px 6px;
  background: var(--border-light);
  color: var(--text-light);
  font-size: 11px;
  border-radius: 4px;
  margin-left: 4px;
}

.alias-arrow {
  color: var(--text-light);
  margin: 0 4px;
}

.allowlist-qq {
  font-weight: 600;
  color: var(--text);
}

.allowlist-mode {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}

.allowlist-mode.whitelist {
  background: var(--success-bg);
  color: var(--success);
}

.allowlist-mode.blacklist {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ========== 统计 ========== */
.stats-section {
  padding: 8px 0;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.stats-rank {
  width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.stats-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

.stats-bar {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.stats-bar-inner {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 3px;
  transition: width 0.3s;
}

.stats-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 30px;
  text-align: right;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stats-cell {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stats-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stats-label {
  font-size: 12px;
  color: var(--text-light);
}

/* ========== 服务不可用页 ========== */
.service-down-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.service-down-card {
  text-align: center;
  max-width: 320px;
}

.service-down-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: var(--warning);
}

.service-down-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.service-down-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 4px;
}

.empty-state .hint {
  font-size: 12px;
  color: var(--text-light);
}

.empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-light);
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 32px 20px;
  color: var(--danger);
  font-size: 14px;
}

.loading {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-light);
  font-size: 14px;
}

/* ========== 群详情页 ========== */
.detail-page .function-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stats-badge {
  padding: 6px 12px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.exit-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.perm-tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.perm-tag.edit {
  background: var(--success-bg);
  color: var(--success);
}

.perm-tag.readonly {
  background: var(--info-bg);
  color: var(--info);
}

/* ========== 下拉刷新提示 ========== */
.pull-refresh-hint {
  text-align: center;
  padding: 12px;
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
}

.pull-refresh-hint span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ========== 群分配弹窗样式 ========== */
.assign-group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.assign-group-item > div:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.assign-group-item:last-child {
  border-bottom: none;
}
.assign-group-item.assigned {
  background: rgba(16, 185, 129, 0.05);
}
.assign-group-item .group-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-group-item .group-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.assign-actions .btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--primary-gradient);
  color: white;
  white-space: nowrap;
}
.assign-actions .btn-small.danger {
  background: var(--danger);
}

/* ========== PC端适配 ========== */
@media screen and (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #7c3aed 100%);
    min-height: 100vh;
  }
  .app-container {
    max-width: 480px;
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .login-page {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
  }
  .login-card {
    max-width: 420px;
  }
}

/* 横屏手机优化 */
@media screen and (min-width: 480px) and (max-width: 767px) {
  .dashboard-cards {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* 超小屏优化 */
@media screen and (max-width: 360px) {
  :root {
    --page-padding: 12px;
    --section-gap: 8px;
  }
  .login-card {
    padding: 32px 20px 24px;
  }
  .dashboard-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ========== 暗色模式 ========== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --surface: #1E293B;
    --surface-hover: #334155;
    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-light: #64748B;
    --border: #334155;
    --border-light: #1E293B;
  }

  .login-page {
    background: linear-gradient(135deg, #0f0a1e 0%, #1a1033 50%, #2d1b69 100%);
  }

  .login-card {
    background: rgba(30, 41, 59, 0.95);
  }

  input[type="text"],
  input[type="password"],
  input[type="email"] {
    background: #1E293B;
    border-color: #334155;
    color: #F1F5F9;
  }

  .stats-summary {
    background: #1E293B;
    border-color: #334155;
  }

  .batch-toolbar {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
  }
}

/* ========== 减少动画偏好 ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== v9.9.9.10 新增样式 ========== */
.dash-card.clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dash-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.2);
}
.dash-card.clickable:active {
  transform: translateY(0);
}
.profile-header {
  cursor: pointer;
  transition: opacity 0.2s;
}
/* ========== v9.9.9.16 UI Improvements ========== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* function-item read-only status badge */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.status-badge.on {
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.off {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ===== Compact User Card ===== */
.user-card-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.user-card-compact .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-card-compact .user-avatar-small {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-card-compact .user-details {
  min-width: 0;
}

.user-card-compact .user-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-compact .user-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.user-card-compact .user-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.user-card-compact .user-actions .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.user-card-compact .user-actions .btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.user-card-compact .user-actions .btn-icon.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* ===== Role Tag ===== */
.role-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.role-tag.self {
  background: var(--primary-bg);
  color: var(--primary);
}

