/* ═══ 微聊 AI 助手 — WeChat Green Theme ═══ */
:root {
  --wechat-green: #07C160;
  --wechat-green-hover: #06AD56;
  --wechat-green-dark: #04943E;
  --wechat-green-light: #E8F8EE;
  --bg: #F7F7F7;
  --bg-white: #FFFFFF;
  --text: #000000;
  --text-secondary: #999999;
  --text-placeholder: #B2B2B2;
  --border: #E5E5E5;
  --danger: #FA5151;
  --warning: #FFC300;
  --success: #07C160;
  --info: #10AEFF;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);

  /* backward-compatible aliases */
  --primary: #07C160;
  --primary-bg: #E8F8EE;
  --primary-hover: #06AD56;
  --text-muted: #999999;
  --text-dim: #B2B2B2;
  --bg-input: #F7F7F7;
  --bg-card: #FFFFFF;
  --bg-dark: #F7F7F7;
  --gradient: linear-gradient(135deg, #07C160, #06AD56);
  --transition: .2s ease;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #F7F7F7;
  color: #000000;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--wechat-green); text-decoration: none; }
a:hover { color: var(--wechat-green-hover); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

input, select, textarea {
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius-xs);
  color: #000000;
  padding: 10px 12px;
  font-size: .9rem;
  width: 100%;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--wechat-green);
  box-shadow: 0 0 0 2px rgba(7,193,96,0.1);
}

.hidden { display: none !important; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-xs);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: 1px solid #E5E5E5; transition: all var(--transition);
  background: #FFFFFF; color: #000000;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary { background: var(--wechat-green); color: #fff; border: none; }
.btn-primary:hover { background: var(--wechat-green-hover); box-shadow: 0 4px 16px rgba(7,193,96,0.25); }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid #E5E5E5; }
.btn-light { background: var(--wechat-green-light); color: var(--wechat-green); border: none; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Cards ── */
.card {
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.card:hover { border-color: rgba(7,193,96,0.2); }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-online, .badge-success { background: rgba(7,193,96,0.1); color: var(--success); }
.badge-offline { background: rgba(153,153,153,0.15); color: var(--text-muted); }
.badge-expired { background: rgba(250,81,81,0.1); color: var(--danger); }
.badge-primary { background: var(--wechat-green-light); color: var(--wechat-green); }
.badge-success-light { background: rgba(7,193,96,0.08); color: var(--success); }
.badge-primary-light { background: rgba(7,193,96,0.08); color: var(--wechat-green); }
.badge-danger-light { background: rgba(250,81,81,0.08); color: var(--danger); }

/* ── Navigation ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E5E5;
}
.nav-brand {
  font-size: 1.3rem; font-weight: 800; letter-spacing: -.5px;
  color: var(--wechat-green);
}
.nav-links { display: flex; align-items: center; gap: 12px; }

/* ── Form Groups ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: .85rem; font-weight: 600;
  color: #333333; margin-bottom: 6px;
}

/* ── Toggle Switch ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #CCCCCC; border-radius: 24px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--wechat-green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Section Title ── */
.section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; color: #000000; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.gap-4 { gap: 16px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .2s;
}
.modal {
  background: #FFFFFF; border: 1px solid #E5E5E5;
  border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s;
}
.modal h3 { font-size: 1.1rem; margin-bottom: 16px; color: #000000; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── Toast ── */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 999;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  animation: toastIn .3s; max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.toast-success { background: var(--wechat-green); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

/* ── Dashboard Layout ── */
.dashboard { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px; min-width: 220px;
  background: #FFFFFF;
  border-right: 1px solid #E5E5E5;
  padding: 16px 0; display: flex; flex-direction: column; gap: 2px;
}
.sidebar-item {
  display: block; padding: 10px 20px;
  font-size: .875rem; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-item:hover { color: #000000; background: #F7F7F7; }
.sidebar-item.active {
  color: var(--wechat-green); background: var(--wechat-green-light);
  border-left-color: var(--wechat-green); font-weight: 600;
}
.main-content { flex: 1; padding: 24px; overflow-y: auto; }
.main-content > section { animation: fadeIn .3s; }

/* ── Overview Cards ── */
.overview-card {
  background: #FFFFFF; border: 1px solid #E5E5E5;
  border-radius: var(--radius); padding: 16px; text-align: center;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.overview-card:hover { transform: translateY(-2px); border-color: rgba(7,193,96,0.2); }
.oc-icon { font-size: 1.5rem; margin-bottom: 6px; }
.oc-value { font-size: 1.4rem; font-weight: 800; color: #000000; }
.oc-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Stat Cards (admin landing) ── */
.stat-card {
  background: #FFFFFF; border: 1px solid #E5E5E5;
  border-radius: var(--radius); padding: 20px; text-align: center;
  box-shadow: var(--shadow); transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--wechat-green); }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* ── Chart ── */
.chart-card { flex: 1; min-width: 280px; }
.chart-title { font-weight: 600; font-size: .9rem; margin-bottom: 12px; color: #000000; }
.chart-bar { border-radius: 3px 3px 0 0; min-width: 4px; transition: height .3s; background: var(--wechat-green); }

/* ── Bot Cards ── */
.bot-card { margin-bottom: 0; }
.bot-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bot-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* ── QR Container ── */
.qr-container { text-align: center; }
.qr-container img { max-width: 240px; margin: 16px auto; border-radius: var(--radius-sm); }
.qr-status { font-size: .9rem; color: var(--text-muted); margin: 8px 0; }

/* ── Plugin Cards (installed) ── */
.plugin-installed-card { margin-bottom: 12px; }
.plugin-installed-header { display: flex; align-items: center; gap: 12px; }
.plugin-installed-actions {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #E5E5E5;
}
.plugin-install-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-xs);
  background: #F7F7F7; margin-bottom: 6px;
}

/* ── Batch Actions ── */
.batch-bar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px 14px; background: #FFFFFF;
  border: 1px solid #E5E5E5; border-radius: var(--radius-sm);
}

/* ── Messages ── */
.msg-bubble { display: flex; gap: 10px; padding: 8px 0; }
.msg-bubble.msg-out { flex-direction: row-reverse; }
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #E5E5E5; display: flex; align-items: center;
  justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.msg-body { max-width: 70%; }
.msg-text {
  padding: 10px 14px; border-radius: 12px;
  font-size: .875rem; line-height: 1.5; word-break: break-word;
}
.msg-in .msg-text { background: #F0F0F0; color: #000000; }
.msg-out .msg-text { background: var(--wechat-green-light); color: #000000; }
.msg-time { font-size: .7rem; color: var(--text-dim); margin-top: 4px; }
.msg-out .msg-time { text-align: right; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; background: #FFFFFF; }
th, td { padding: 10px 14px; text-align: left; font-size: .85rem; }
th { color: var(--text-muted); font-weight: 600; border-bottom: 1px solid #E5E5E5; }
td { border-bottom: 1px solid #F0F0F0; }
tr:hover td { background: #FAFAFA; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.table-wrap { overflow-x: auto; }

/* ── Plugin Store ── */
.plugin-store-hero {
  text-align: center; padding: 80px 24px 40px;
  background: linear-gradient(135deg, #07C160, #06AD56);
  color: #FFFFFF;
}
.plugin-store-hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; color: #FFFFFF; }
.plugin-store-hero h1 span { color: #FFFFFF; }
.plugin-store-hero p { color: rgba(255,255,255,0.85); font-size: 1.05rem; margin-bottom: 24px; }
.plugin-search-bar { max-width: 480px; margin: 0 auto; }
.plugin-search-bar input {
  padding: 12px 20px; font-size: 1rem; border-radius: 24px;
  background: rgba(255,255,255,0.95); border: none; color: #000000;
}
.plugin-search-bar input::placeholder { color: var(--text-placeholder); }
.plugin-store-container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Source & Category Tabs */
.plugin-source-tabs, .plugin-categories {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.plugin-source-btn, .plugin-cat-btn {
  padding: 6px 16px; border-radius: 20px; font-size: .8rem;
  font-weight: 600; cursor: pointer; border: 1px solid #E5E5E5;
  background: #FFFFFF; color: var(--text-muted); transition: all var(--transition);
}
.plugin-source-btn.active, .plugin-cat-btn.active {
  background: var(--wechat-green); color: #fff; border-color: var(--wechat-green);
}
.plugin-source-btn:hover, .plugin-cat-btn:hover { border-color: var(--wechat-green); }

/* Plugin Grid */
.plugin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: 16px;
}
.plugin-card {
  background: #FFFFFF; border: 1px solid #E5E5E5;
  border-radius: var(--radius); padding: 20px;
  cursor: pointer; transition: all var(--transition);
  display: flex; gap: 14px; box-shadow: var(--shadow);
}
.plugin-card:hover { border-color: var(--wechat-green); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(7,193,96,0.1); }
.plugin-card-icon { font-size: 2rem; flex-shrink: 0; }
.plugin-card-body { flex: 1; min-width: 0; }
.plugin-card-name { font-weight: 700; font-size: .95rem; margin-bottom: 4px; color: #000000; }
.plugin-card-desc {
  font-size: .82rem; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plugin-card-meta {
  display: flex; gap: 10px; margin-top: 8px;
  font-size: .75rem; color: var(--text-dim);
}
.plugin-cat-tag {
  background: var(--wechat-green-light); color: var(--wechat-green);
  padding: 1px 8px; border-radius: 10px; font-size: .7rem;
}

/* ── Credits Center ── */
.credits-container { display: flex; flex-direction: column; gap: 20px; }
.credit-balance-card {
  background: var(--gradient); border: none; position: relative; overflow: hidden;
  color: #FFFFFF; border-radius: var(--radius); padding: 20px;
}
.credit-balance-card .bg-pattern {
  position: absolute; inset: 0; opacity: .08;
  background-image: radial-gradient(circle at 20% 50%, #fff 1px, transparent 1px),
                    radial-gradient(circle at 80% 20%, #fff 1px, transparent 1px);
  background-size: 40px 40px;
}
.balance-content { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.balance-label { font-size: .9rem; opacity: .85; margin-bottom: 4px; }
.balance-amount { font-size: 2.4rem; font-weight: 800; }
.balance-stats { display: flex; gap: 20px; margin-top: 8px; }
.stat-item span { font-size: .8rem; opacity: .7; }
.stat-item strong { display: block; font-size: 1rem; }
.stat-divider { width: 1px; background: rgba(255,255,255,.2); }

.checkin-card { }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.streak-badge { font-size: .8rem; color: var(--wechat-green); background: var(--wechat-green-light); padding: 4px 12px; border-radius: 20px; }

.checkin-timeline {
  display: flex; justify-content: space-between; gap: 8px; margin-bottom: 20px;
}
.day-item { text-align: center; flex: 1; }
.day-circle {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
  background: #F7F7F7; font-size: .85rem; font-weight: 700;
  border: 2px solid #E5E5E5; transition: all var(--transition);
}
.day-item.completed .day-circle { background: var(--wechat-green); border-color: var(--wechat-green); color: #fff; }
.day-item.today .day-circle { border-color: var(--wechat-green); animation: todayPulse 2s infinite; }
.day-item.big-reward .day-circle { background: rgba(255,195,0,0.1); border-color: var(--warning); }
.day-reward { font-size: .75rem; color: var(--text-muted); }
.day-reward.highlight { color: var(--wechat-green); font-weight: 700; }
.day-label { font-size: .65rem; color: var(--text-dim); }

.checkin-action-area { text-align: center; }
.checkin-tip { font-size: .8rem; color: var(--text-muted); margin-top: 8px; }

.invite-card { }
.invite-layout { display: flex; gap: 24px; flex-wrap: wrap; }
.invite-info { flex: 1; min-width: 240px; }
.invite-desc { font-size: .9rem; color: var(--text-muted); margin: 8px 0 16px; line-height: 1.6; }
.highlight-text { color: var(--wechat-green); font-weight: 700; }
.invite-stats-row { display: flex; gap: 24px; }
.invite-stat .label { font-size: .8rem; color: var(--text-muted); }
.invite-stat .value { font-size: 1.3rem; font-weight: 800; color: var(--wechat-green); }
.invite-actions-box { min-width: 220px; }
.code-box { margin-bottom: 12px; }
.code-box label { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; display: block; }
.code-display {
  display: flex; align-items: center; gap: 8px;
  background: #F7F7F7; padding: 10px 14px; border-radius: var(--radius-xs);
  font-family: monospace; font-size: 1.1rem; font-weight: 700; color: #000000;
}
.btn-copy {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  padding: 4px; border-radius: 4px; transition: all var(--transition);
}
.btn-copy:hover { background: rgba(7,193,96,0.1); }

.history-card { }
.credit-table { width: 100%; }
.pagination-wrap {
  display: flex; justify-content: center; align-items: center;
  gap: 12px; margin-top: 16px;
}
.page-info { font-size: .85rem; color: var(--text-muted); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D0D0D0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #B0B0B0; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes todayPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(7,193,96,0.3); } 50% { box-shadow: 0 0 12px 4px rgba(7,193,96,0.15); } }
@keyframes heroGlow { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* ── Sidebar Toggle (mobile) ── */
.sidebar-toggle {
  display: none; background: none; border: none;
  color: #000000; font-size: 1.3rem; cursor: pointer; padding: 4px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -260px; top: 56px; bottom: 0;
    z-index: 90; width: 240px; transition: left .3s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.sidebar-open { left: 0; }
  .sidebar-toggle { display: block; }
  .main-content { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .plugin-grid { grid-template-columns: 1fr; }
  .nav { padding: 0 12px; }
  .balance-amount { font-size: 1.8rem; }
  .checkin-timeline { flex-wrap: wrap; }
  .day-circle { width: 34px; height: 34px; font-size: .75rem; }
  .invite-layout { flex-direction: column; }
  .steps { flex-direction: column; align-items: center; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ── Print ── */
@media print {
  .nav, .sidebar, .modal-overlay, .toast { display: none !important; }
  body { background: #fff; color: #000; }
}

/* 密码框禁止中文输入法 */
input[type="password"] {
  ime-mode: disabled !important;
  -webkit-text-security: disc;
}
