/* ============================================================
   H5 业务员系统样式表(重构版)
   现代简约商务风 · 统一设计系统
   最后修改: 2026-08-02 11:30:00
   ============================================================ */

/* ═══════════════════════════════════════════
   1. 设计 Token(CSS 变量)
   ═══════════════════════════════════════════ */
:root {
  --brand: #4F46E5;
  --brand-light: #EEF2FF;
  --brand-dark: #4338CA;
  --green: #10B981;
  --green-light: #D1FAE5;
  --green-dark: #065F46;
  --orange: #F59E0B;
  --orange-light: #FEF3C7;
  --orange-dark: #92400E;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --red-dark: #991B1B;
  --blue: #3B82F6;
  --blue-light: #DBEAFE;
  --blue-dark: #1E40AF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-btn: 8px;
  --radius-badge: 6px;
  --tabbar-h: 56px;
}

/* ═══════════════════════════════════════════
   2. 基础重置
   ═══════════════════════════════════════════ */
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font: 15px -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50); color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
}
input,button,select { font: inherit; }
.logo-img { display:block; }

/* ═══════════════════════════════════════════
   3. 通用组件
   ═══════════════════════════════════════════ */

/* ── 按钮 ── */
.btn {
  height: 44px; padding: 0 16px; border: 1px solid var(--gray-200); border-radius: var(--radius-btn);
  background: #fff; color: var(--gray-700); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); opacity: .9; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 6px rgba(79,70,229,.2); }
.btn-danger { background: #fff; color: var(--red); border-color: #FCA5A5; }
.btn-danger:active { background: var(--red-light); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-btn); gap: 4px; }
.btn-sm svg { width: 13px; height: 13px; }

/* ── 徽章 ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-badge);
  white-space: nowrap; flex-shrink: 0;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-success { background: var(--green-light); color: var(--green-dark); }
.badge-success::before { background: var(--green); }
.badge-info { background: var(--blue-light); color: var(--blue-dark); }
.badge-info::before { background: var(--blue); }
.badge-warning { background: var(--orange-light); color: var(--orange-dark); }
.badge-warning::before { background: var(--orange); }
.badge-danger { background: var(--red-light); color: var(--red-dark); }
.badge-danger::before { background: var(--red); }
.badge-muted { background: var(--gray-100); color: var(--gray-500); }
.badge-muted::before { background: var(--gray-400); }
.badge-brand { background: var(--brand-light); color: var(--brand); }
.badge-brand::before { background: var(--brand); }

/* ── 头像 ── */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-lg { width: 64px; height: 64px; font-size: 26px; box-shadow: 0 4px 12px rgba(79,70,229,.25); }
.avatar-sm { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; }

/* ═══════════════════════════════════════════
   4. 登录页（品牌化深蓝背景 + 透明气泡装饰）
   ═══════════════════════════════════════════ */
#loginPage { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: 60px 24px; box-sizing: border-box; position: relative; overflow: hidden; background: linear-gradient(140deg, #16204A 0%, #1E3060 30%, #2A4070 55%, #1E3060 80%, #16204A 100%); }
/* 背景装饰容器 */
#loginPage .login-bg-particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#loginPage .login-hero-scene { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#loginPage .login-hero-scene .hero-stars { position: absolute; inset: 0; }
#loginPage .login-hero-scene .hero-moon { position: absolute; top: 10%; right: 14%; width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #F5E6C8, #D4C08A 60%, #BEA672); opacity: 0.95; box-shadow: 0 0 60px rgba(212,192,138,0.55), 0 0 120px rgba(212,192,138,0.3), 0 0 200px rgba(212,192,138,0.15); animation: h5MoonGlow 4s ease-in-out infinite; }
@keyframes h5MoonGlow { 0%,100% { box-shadow: 0 0 60px rgba(212,192,138,0.55), 0 0 120px rgba(212,192,138,0.3), 0 0 200px rgba(212,192,138,0.15); } 50% { box-shadow: 0 0 80px rgba(212,192,138,0.7), 0 0 160px rgba(212,192,138,0.4), 0 0 250px rgba(212,192,138,0.2); } }
#loginPage .login-bg-particles .particle { border-color: rgba(255,255,255,0.6) !important; }
#loginPage .login-hero-scene .star { width: 4px !important; height: 4px !important; box-shadow: 0 0 8px rgba(255,255,255,1), 0 0 16px rgba(255,255,255,0.5) !important; }
#loginPage .login-sea { position: fixed; bottom: 0; left: 0; right: 0; height: 15%; background: linear-gradient(180deg, rgba(27,43,87,0) 0%, rgba(15,26,58,0.5) 40%, rgba(10,18,45,0.8) 100%); pointer-events: none; z-index: 0; }
#loginPage .login-glow { position: fixed; width: 500px; height: 500px; border-radius: 50%; background: radial-gradient(circle, rgba(190,166,114,0.12) 0%, transparent 70%); pointer-events: none; z-index: 0; }
#loginPage .login-glow-1 { top: -150px; right: -100px; animation: h5GlowPulse 6s ease-in-out infinite; }
#loginPage .login-glow-2 { bottom: -200px; left: -150px; animation: h5GlowPulse 8s ease-in-out infinite reverse; }
@keyframes h5GlowPulse { 0%,100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.2); } }
#loginPage .login-bg-glow { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 800px; height: 800px; border-radius: 50%; background: radial-gradient(circle, rgba(60,100,180,0.08) 0%, rgba(40,70,140,0.04) 30%, transparent 70%); pointer-events: none; z-index: 0; }
/* 内容层 */
#loginPage .login-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; flex: 1; }
.login-logo-wrap { text-align: center; margin-bottom: 20px; position: relative; padding-top: 8px; }
.login-logo-glow { position: absolute; width: 180px; height: 180px; background: radial-gradient(circle, rgba(190,166,114,0.18) 0%, rgba(212,192,138,0.08) 40%, transparent 70%); border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 0; pointer-events: none; }
.login-logo-wrap .logo-img { width: 120px; height: 120px; border-radius: 20px; margin: 0 auto; position: relative; z-index: 1; box-shadow: 0 8px 32px rgba(190,166,114,0.25); }
.login-desc { text-align: center; color: rgba(255,255,255,0.6); font-size: 14px; margin-bottom: 32px; }
.login-card { background: rgba(255,255,255,0.98); border-radius: 20px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(15,26,58,0.25), 0 8px 24px rgba(0,0,0,0.12); position: relative; }
.login-card::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 60px; height: 3px; background: linear-gradient(90deg, transparent, #BEA672, transparent); border-radius: 0 0 3px 3px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.login-card input { width: 100%; height: 46px; border: 1.5px solid var(--gray-200); border-radius: 10px; padding: 0 14px; font-size: 15px; margin-bottom: 16px; outline: none; transition: all 0.2s; background: #F8FAFC; }
.login-card input:focus { border-color: #BEA672; box-shadow: 0 0 0 3px rgba(190,166,114,0.12); background: #fff; }
.pwd-wrap { position: relative; margin-bottom: 16px; }
.pwd-wrap input { margin-bottom: 0; padding-right: 42px; }
.pwd-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--gray-400); display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; transition: color .2s; }
.pwd-toggle:hover { color: #BEA672; }
.pwd-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pwd-toggle-sm { width: 18px; height: 18px; }
.pwd-toggle-sm svg { width: 16px; height: 16px; }
.login-btn { width: 100%; height: 48px; background: linear-gradient(135deg, #BEA672, #D4C08A); color: #1B2B57; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.25s cubic-bezier(0.22,1,0.36,1); box-shadow: 0 4px 14px rgba(190,166,114,0.3); }
.login-btn:hover { box-shadow: 0 8px 24px rgba(190,166,114,0.4); transform: translateY(-2px); }
.login-btn:active { opacity: .8; transform: translateY(0); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; display: none; }

/* ═══════════════════════════════════════════
   5. App 容器 + 统一 Header
   ═══════════════════════════════════════════ */
.app-container { max-width: 480px; margin: 0 auto; background: var(--gray-50); min-height: 100vh; position: relative; padding-bottom: var(--tabbar-h); }

/* 统一页面 Header(三个 Tab 页共用) */
.page-header {
  position: sticky; top: 0; z-index: 10; background: #fff;
  border-bottom: 1px solid var(--gray-200); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.page-header .logo-img { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
.page-title { font-size: 17px; font-weight: 700; color: var(--gray-900); flex: 1; }
.page-header-right { display: flex; align-items: center; gap: 8px; }
.header-user { font-size: 12px; color: var(--gray-500); font-weight: 500; white-space: nowrap; }

/* ═══════════════════════════════════════════
   6. 底部 Tab 栏
   ═══════════════════════════════════════════ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  max-width: 480px; margin: 0 auto; height: var(--tabbar-h);
  background: #fff; border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(0,0,0,.04);
  display: flex; align-items: stretch;
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: 11px; font-weight: 500; transition: color .15s;
  padding: 6px 0;
}
.tabbar-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.tabbar-item.active { color: var(--brand); font-weight: 600; }

/* ═══════════════════════════════════════════
   7. 工作台页(Bot 列表)
   ═══════════════════════════════════════════ */
#mainPage { display: none; }
.action-row { display: flex; gap: 12px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--gray-100); }
.create-btn, .invite-btn { height: 42px; font-size: 15px; font-weight: 700; border-radius: 10px; padding: 0 12px; border: none; cursor: pointer; display: flex; white-space: nowrap; transition: all .15s; flex: 1; min-width: 0; letter-spacing: 0.3px; justify-content: center; align-items: center; }
.create-btn { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(79,70,229,0.25); }
.create-btn:active { opacity: .8; transform: scale(0.97); }
.invite-btn { background: #059669; color: #fff; box-shadow: 0 2px 6px rgba(5,150,105,0.25); }
.invite-btn:active { opacity: .8; transform: scale(0.97); }

/* Filter tabs */
.filter-bar { display: flex; gap: 8px; padding: 12px 16px 4px; background: #fff; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.filter-tab { flex-shrink: 0; padding: 8px 18px; border-radius: 20px; font-size: 15px; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-500); cursor: pointer; transition: all .2s; white-space: nowrap; }
.filter-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-tab:active { opacity: .7; }

/* Search */
.search-row { display: flex; gap: 6px; padding: 8px 16px 10px; background: #fff; border-bottom: 1px solid var(--gray-100); align-items: center; }
.search-row input { flex: 1; height: 42px; border: 1px solid var(--gray-200); border-radius: 10px; padding: 0 16px; font-size: 14px; outline: none; background: var(--gray-50); min-width: 0; }
.search-row input:focus { border-color: var(--brand); background: #fff; }

/* Bot list */
.bot-list { padding: 12px 16px 16px; }
.bot-card { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s; position: relative; overflow: hidden; }
.bot-card::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; border-radius: 0 2px 2px 0; }
.bot-card.online::before { background: var(--green); }
.bot-card.offline::before { background: var(--orange); }
.bot-card.failed::before { background: var(--red); }
.bot-card.frozen::before { background: var(--brand); }
.bot-card.pending::before { background: var(--gray-400); }
.bot-card:active { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: scale(0.98); }

.bot-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bot-card-avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0; background: var(--gray-400); }
.bot-card-avatar.online { background: var(--green); }
.bot-card-avatar.offline { background: var(--orange); }
.bot-card-avatar.failed { background: var(--red); }
.bot-card-avatar.frozen { background: var(--brand); }
.bot-card-avatar.pending { background: var(--gray-400); }
.bot-card-info { flex: 1; min-width: 0; }
.bot-card-name { font-size: 15px; font-weight: 600; color: var(--gray-900); display: flex; align-items: center; gap: 6px; }
.bot-card-profile { font-size: 11px; color: var(--gray-400); margin-top: 1px; }

.bot-card-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--gray-500); margin-bottom: 10px; padding-left: 46px; }
.bot-card-meta .meta-label { color: var(--gray-400); }
.bot-card-meta .meta-val { color: var(--gray-700); font-weight: 500; }
.bot-card-meta-row { display: flex; align-items: center; gap: 6px; }

.bot-card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; min-height: 34px; margin: 0 -16px -16px; padding-left: 16px; padding-right: 16px; padding-bottom: 12px; border-top: 1px solid var(--gray-100); }
.bot-card-actions .no-actions { width: 100%; text-align: center; font-size: 11px; color: var(--gray-400); line-height: 34px; }
/* 卡片内小操作按钮配色 */
.bot-card-actions .btn-sm { flex: 1; min-width: 0; border: none; }
.act-edit { background: var(--brand-light); color: var(--brand); }
.act-scan { background: var(--brand); color: #fff; }
.act-freeze { background: var(--orange-light); color: var(--orange-dark); }
.act-unfreeze { background: var(--green-light); color: var(--green-dark); }
.act-calendar { background: var(--gray-100); color: var(--gray-700); }

/* 剩余天数 */
.days-remaining { display:inline-block; font-size:12px; font-weight:600; padding:2px 8px; border-radius:8px; }
.days-remaining.days-ok { background: var(--green-light); color: var(--green-dark); }
.days-remaining.days-warn { background: var(--orange-light); color: var(--orange-dark); }
.days-remaining.days-over { background: var(--red-light); color: var(--red-dark); }

/* ═══════════════════════════════════════════
   8. 授权码页
   ═══════════════════════════════════════════ */
#authCodePage { display: none; }
.authcode-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--gray-50); padding-bottom: calc(var(--tabbar-h) + 16px); }

.page-section { background: #fff; border-radius: var(--radius); margin: 12px 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.page-section-title { font-size: 14px; font-weight: 600; color: var(--gray-700); padding: 14px 16px 8px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.page-section-body { padding: 16px; }

/* 配额徽章(授权码页 Header 用) */
.quota-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: var(--brand-light); color: var(--brand); white-space: nowrap; }
.quota-badge.full { background: var(--red-light); color: var(--red-dark); }
.quota-badge.warning { background: var(--orange-light); color: var(--orange-dark); }

/* 授权码列表项 */
.authcode-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.authcode-item:last-child { border-bottom: none; }
.authcode-main { flex: 1; min-width: 0; }
.authcode-text { font-family: monospace; font-size: 13px; color: var(--gray-900); font-weight: 600; letter-spacing: 0.5px; word-break: break-all; }
.authcode-meta { font-size: 11px; color: var(--gray-500); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.authcode-info { display: inline-flex; align-items: center; gap: 2px; }

/* 关联用户列表项 */
.user-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.user-item:last-child { border-bottom: none; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.user-meta { font-size: 12px; color: var(--gray-500); line-height: 1.5; }
.user-meta span { margin-right: 12px; }
.user-code { font-family: monospace; font-size: 11px; color: var(--brand); }

/* ═══════════════════════════════════════════
   9. 我的页(个人中心)
   ═══════════════════════════════════════════ */
#profilePage { display: none; }
.profile-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--gray-50); padding-bottom: calc(var(--tabbar-h) + 16px); }

/* 业务员信息卡片(白底,无渐变) */
.profile-card { background: #fff; border: 1px solid var(--gray-100); border-radius: var(--radius); padding: 24px 16px; margin: 12px 16px; text-align: center; box-shadow: var(--shadow-sm); }
.profile-avatar-wrap { position: relative; display: inline-block; margin: 0 auto 12px; }
.profile-avatar-wrap .avatar { margin: 0; }
.profile-edit-btn {
  position: absolute; bottom: -2px; right: -6px; width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid #fff; background: var(--brand);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; box-shadow: 0 2px 6px rgba(79,70,229,.35); transition: transform .15s, box-shadow .15s;
}
.profile-edit-btn svg { width: 13px; height: 13px; }
.profile-edit-btn:active { transform: scale(.92); box-shadow: 0 1px 3px rgba(79,70,229,.25); }
.profile-name { font-size: 18px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.profile-meta { font-size: 13px; color: var(--brand); font-weight: 500; margin-bottom: 4px; }
.profile-joined { font-size: 12px; color: var(--gray-500); }

/* 个人资料表单 */
.profile-form-group { margin-bottom: 14px; }
.profile-form-group:last-child { margin-bottom: 0; }
.profile-form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.profile-form-group input { width: 100%; height: 42px; border: 1px solid var(--gray-200); border-radius: var(--radius-btn); padding: 0 12px; font-size: 14px; outline: none; transition: border-color .2s; background: #fff; color: var(--gray-900); }
.profile-form-group input:focus { border-color: var(--brand); }
.profile-form-group input::placeholder { color: var(--gray-400); }
.profile-form-group .pwd-wrap { margin-bottom: 0; }
.profile-form-group .pwd-wrap input { padding-right: 42px; }

/* 账号设置列表 */
.profile-list { padding: 4px 16px 12px; }
.profile-list-item { display: flex; align-items: center; width: 100%; background: none; border: none; border-bottom: 1px solid var(--gray-100); padding: 14px 4px; cursor: pointer; text-align: left; font-size: 14px; color: var(--gray-900); transition: background .15s; gap: 12px; }
.profile-list-item:last-child { border-bottom: none; }
.profile-list-item:active { background: var(--gray-50); }
.profile-list-item:first-child { padding-top: 10px; }
.profile-list-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--brand-light); color: var(--brand); border-radius: var(--radius-btn); flex-shrink: 0; }
.profile-list-icon svg { width: 16px; height: 16px; }
.profile-list-label { flex: 1; font-weight: 500; color: var(--gray-900); }
.profile-list-value { font-size: 12px; color: var(--gray-500); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-list-arrow { color: var(--gray-400); display: flex; align-items: center; flex-shrink: 0; }
.profile-list-arrow svg { width: 16px; height: 16px; }

/* 空状态 */
.profile-empty { text-align: center; padding: 24px 12px; font-size: 13px; color: var(--gray-400); }

/* ═══════════════════════════════════════════
   10. Bottom Sheet
   ═══════════════════════════════════════════ */
.sheet-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.4); display: none; animation: fadeIn .2s; }
.sheet-overlay.show { display: block; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.sheet { position: fixed; bottom: 0; left: 0; right: 0; z-index: 101; background: #fff; border-radius: 16px 16px 0 0; max-height: 85vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .3s ease; }
.sheet.show { transform: translateY(0); }
.sheet-head { flex-shrink: 0; background: #fff; border-radius: 16px 16px 0 0; position: relative; z-index: 2; padding: 20px 20px 0; }
.sheet-handle { width: 36px; height: 4px; background: var(--gray-200); border-radius: 2px; margin: 0 auto 16px; }
.sheet-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; padding-right: 36px; }
.sheet-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border: none; background: var(--gray-100); border-radius: 50%; font-size: 16px; cursor: pointer; line-height: 32px; text-align: center; z-index: 3; }
.sheet-body-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 20px 28px; }

/* Sheet 内表单字段 */
.sheet-field { margin-bottom: 14px; }
.sheet-field label { display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.sheet-field .value { font-size: 15px; color: var(--gray-900); }
.sheet-field input, .sheet-field select { width: 100%; height: 40px; border: 1px solid var(--gray-200); border-radius: var(--radius-btn); padding: 0 12px; font-size: 14px; outline: none; }
.sheet-field input:focus, .sheet-field select:focus { border-color: var(--brand); }

/* Sheet 内表单(修改密码/默认设置) */
.sheet-form { padding: 4px 0 8px; }
.sheet-form-group { margin-bottom: 16px; }
.sheet-form-group:last-of-type { margin-bottom: 20px; }
.sheet-form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.sheet-form-group input { width: 100%; height: 42px; border: 1px solid var(--gray-200); border-radius: var(--radius-btn); padding: 0 12px; font-size: 14px; outline: none; transition: border-color .2s; background: #fff; color: var(--gray-900); }
.sheet-form-group input:focus { border-color: var(--brand); }
.sheet-form-group input::placeholder { color: var(--gray-400); }
.sheet-form-group .pwd-wrap { margin-bottom: 0; }
.sheet-form-group .pwd-wrap input { padding-right: 42px; }

/* Sheet 内 preset-row 间距 */
.sheet-form .preset-row { margin-bottom: 0; }
.sheet-form .preset-row .preset-btn { flex: 1; min-width: 52px; }
.sheet-form .preset-row { margin-bottom: 0; }

/* Sheet 分组 */
.sheet-section { margin-bottom: 16px; }
.sheet-section-title { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--gray-100); }

/* 状态引导 */
.status-guide { font-size: 13px; padding: 8px 12px; border-radius: var(--radius-btn); margin-bottom: 10px; line-height: 1.4; background: #EFF6FF; color: var(--blue-dark); }

/* Sheet 内按钮间距 */
.sheet-body-scroll .btn-block + .btn-block { margin-top: 8px; }
.sheet-body-pad { padding: 0 20px 28px; }

/* ═══════════════════════════════════════════
   11. Toast / Loading / Empty
   ═══════════════════════════════════════════ */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--gray-900); color: #fff; padding: 12px 24px; border-radius: var(--radius-btn); font-size: 14px; z-index: 999; animation: toastIn .3s; max-width: 90%; }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(20px); } }
.toast.error { background: var(--red); }
.toast.success { background: #059669; }

.empty-state { text-align: center; padding: 60px 24px; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.loading { text-align: center; padding: 40px; color: var(--gray-400); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: var(--brand); border-radius: 50%; animation: spin .6s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pull hint */
.pull-hint { text-align: center; padding: 12px; font-size: 12px; color: var(--gray-400); display: none; }

/* ═══════════════════════════════════════════
   12. 工具类(preset / qr / invite / brand)
   ═══════════════════════════════════════════ */

/* 预设按钮 */
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.preset-btn { height: 36px; padding: 0 14px; border: 1px solid var(--gray-200); border-radius: var(--radius-btn); background: #fff; color: var(--gray-700); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; flex: 1; min-width: 52px; }
.preset-btn.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.preset-btn:active { opacity: .7; }
.cutoff-preview { font-size: 13px; color: var(--gray-500); text-align: center; margin: 8px 0; min-height: 20px; }
.cutoff-preview strong { color: var(--gray-900); }

/* QR */
.qr-container { display: flex; justify-content: center; align-items: center; padding: 12px 0; }
.qr-container img { width: 180px; height: 180px; max-width: 220px; border-radius: var(--radius-btn); }
.qr-status { text-align: center; font-size: 13px; color: var(--gray-500); margin-top: 12px; min-height: 20px; }
.qr-wrap { display: inline-block; background: #fff; padding: 10px; border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.qr-wrap img { width: 180px; height: 180px; display: block; border-radius: 4px; }

/* 邀请链接展示 */
.invite-link-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-btn); padding: 12px; font-size: 13px; word-break: break-all; font-family: monospace; margin-bottom: 12px; color: var(--gray-700); line-height: 1.5; }
.qr-save-btn { display: block; width: 100%; height: 44px; border-radius: var(--radius-btn); font-size: 14px; font-weight: 600; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-700); cursor: pointer; margin-top: 8px; text-align: center; line-height: 44px; text-decoration: none; transition: all .15s; }
.qr-save-btn:active { background: var(--gray-100); }

/* 品牌工具类(减少内联样式) */
.brand-icon-lg { font-size: 28px; margin-bottom: 4px; display: block; }
.brand-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.brand-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.section-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.benefit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.benefit-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--gray-400); background: var(--gray-50); border-radius: var(--radius-btn); padding: 6px 8px; }
.brand-card { background: var(--brand-light); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.brand-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-light); color: var(--brand); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 500; }
.invite-code-text { font-size: 20px; font-weight: 700; color: var(--brand-dark); font-family: monospace; letter-spacing: 2px; }
.action-btn-row { display: flex; gap: 8px; margin-top: 12px; }
.action-btn-row .btn { flex: 1; margin-top: 0; }
.tag-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }

/* 生成授权码结果列表 */
.gen-code-list { margin: 8px 0; }
.gen-code-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--brand-light); border-radius: var(--radius-btn); margin-bottom: 6px; cursor: pointer; }
.gen-code-item:active { opacity: .8; }
.gen-code-text { font-family: monospace; font-size: 13px; font-weight: 600; color: var(--brand-dark); }
.gen-code-copy { font-size: 11px; color: var(--brand); white-space: nowrap; }

/* 多主题知识库 - 移动端卡片 */
.kb-topic-mgrid { display: flex; flex-direction: column; gap: 6px; }
.kb-topic-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: 10px; cursor: pointer; transition: all .15s; background: #fff; }
.kb-topic-mobile:active { opacity: .8; }
.kb-topic-mobile.selected { border-color: var(--brand); background: var(--brand-light); box-shadow: 0 0 0 1px var(--brand); }
.kb-topic-mobile input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; margin: 0; }
.kb-topic-micon { font-size: 22px; line-height: 1; width: 30px; text-align: center; }
.kb-topic-mname { flex: 1; font-size: 14px; font-weight: 500; color: var(--gray-900); }
.kb-topic-mcount { font-size: 11px; color: var(--gray-400); padding: 2px 8px; border-radius: var(--radius-badge); background: var(--gray-50); }
.kb-topic-mobile.selected .kb-topic-mcount { background: var(--brand); color: #fff; }

/* ═══════════════════════════════════════════
   13. 响应式
   ═══════════════════════════════════════════ */

/* Tablet */
@media (min-width: 640px) {
  body { background: var(--gray-100); }
  .login-card { max-width: 420px; margin: 0 auto; }
  .filter-bar { justify-content: center; flex-wrap: wrap; overflow-x: visible; }
  .search-row { justify-content: center; gap: 10px; }
  .search-row input { max-width: 320px; }
  .bot-list { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
  .bot-card { margin-bottom: 0; }
  .bot-card-actions .btn-sm { height: 32px; font-size: 11px; }
}

/* Desktop */
@media (min-width: 1024px) {
  .app-container { max-width: 1200px; }
  .bot-list { grid-template-columns: repeat(3,1fr); }
  .page-header { padding: 14px 24px; }
  .filter-bar { padding: 12px 24px 0; gap: 8px; }
  .filter-tab { padding: 7px 18px; font-size: 14px; }
  .search-row { padding: 6px 24px 12px; }
}

/* Desktop sheet → centered modal */
@media (min-width: 768px) {
  .sheet { left: 50%; top: 50%; bottom: auto; right: auto; transform: translate(-50%,-50%) scale(.95); max-width: 520px; width: 90%; border-radius: 16px; transition: transform .25s ease, opacity .2s; opacity: 0; pointer-events: none; }
  .sheet.show { transform: translate(-50%,-50%) scale(1); opacity: 1; pointer-events: auto; }
  .sheet-handle { display: none; }
  .sheet-fields-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
}

/* Hover */
@media (hover: hover) {
  .bot-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
  .btn:hover { opacity: .88; }
  .btn-primary:hover { opacity: .9; box-shadow: 0 4px 12px rgba(79,70,229,0.3); transform: translateY(-1px); }
  .filter-tab:hover { border-color: var(--brand); color: var(--brand); }
  .preset-btn:hover { border-color: var(--brand); color: var(--brand); }
  .sheet-close:hover { background: var(--gray-200); }
  .invite-btn:hover { opacity: .85; }
  .tabbar-item:hover { color: var(--gray-700); }
  .tabbar-item.active:hover { color: var(--brand); }
}
