:root {
  --bg: #f5f6fa;
  --bg-soft: radial-gradient(900px 420px at 10% -10%, rgba(0, 183, 240, 0.22), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(0, 183, 240, 0.08), transparent 50%),
    linear-gradient(180deg, #f3fbfe 0%, #f5f6fa 40%, #f0f2f8 100%);
  --card: #fff;
  --primary: #00b7f0;
  --primary-dark: #0099cc;
  --primary-soft: rgba(0, 183, 240, 0.12);
  --accent: #00b7f0;
  --accent-soft: rgba(0, 183, 240, 0.12);
  --text: #1f2937;
  --muted: #6b7280;
  --border: rgba(0, 183, 240, 0.08);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 183, 240, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 183, 240, 0.18);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --danger: #ef4444;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 60px;
  --header-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  background-image: var(--bg-soft);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: transparent;
}

.app-header {
  flex-shrink: 0;
  height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, #0099cc 0%, #00b7f0 55%, #33c5f3 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 183, 240, 0.35);
  position: relative;
  z-index: 2;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.header-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-user {
  font-size: 12px;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.header-balance {
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.panel.active {
  display: flex;
}

/* AI 功能网格 — 现代卡片式 3×2 */
.ai-tab-section {
  flex-shrink: 0;
  padding: 14px 14px 0;
  background: transparent;
  max-height: 52vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}


.ai-tab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-md);
}

.ai-cat-head {
  padding: 4px 4px 10px;
}

.ai-cat-head strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: -0.02em;
}

.ai-cat-head span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* 十大类目：桌面内容完整装入手机白底面板（2 列卡片） */
.ai-tab-grid--10 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.ai-tab-grid--10 .ai-tab-item {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  min-height: 0;
  padding: 12px 10px;
  text-align: left;
  border: 1px solid #eef0f4;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.ai-tab-grid--10 .ai-tab-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.ai-tab-grid--10 .ai-tab-icon { font-size: 18px; }

.ai-tab-grid--10 .ai-tab-label {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  text-align: left;
  max-width: none;
  padding: 0;
}

.ai-tab-desc {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.4;
  text-align: left;
  padding: 0;
}

.ai-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 6px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ai-tab-item:active { transform: scale(0.96); }

.ai-tab-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-tab-item:nth-child(1) .ai-tab-icon-wrap { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.ai-tab-item:nth-child(2) .ai-tab-icon-wrap { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.ai-tab-item:nth-child(3) .ai-tab-icon-wrap { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.ai-tab-item:nth-child(4) .ai-tab-icon-wrap { background: linear-gradient(135deg, #cffafe, #a5f3fc); }
.ai-tab-item:nth-child(5) .ai-tab-icon-wrap { background: linear-gradient(135deg, #dbeafe, #93c5fd); }
.ai-tab-item:nth-child(6) .ai-tab-icon-wrap { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
.ai-tab-item:nth-child(7) .ai-tab-icon-wrap { background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }
.ai-tab-item:nth-child(8) .ai-tab-icon-wrap { background: linear-gradient(135deg, #fce7f3, #f9a8d4); }
.ai-tab-item:nth-child(9) .ai-tab-icon-wrap { background: linear-gradient(135deg, #ffedd5, #fed7aa); }
.ai-tab-item:nth-child(10) .ai-tab-icon-wrap { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.ai-tab-item.active {
  background: linear-gradient(145deg, rgba(0, 183, 240, 0.10), rgba(51, 197, 243, 0.06));
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1.5px rgba(0, 183, 240, 0.35);
}

.ai-tab-grid--10 .ai-tab-item.active {
  border-color: #00b7f0;
  background: #e8f8fd;
  box-shadow: none;
}

.ai-tab-item.active .ai-tab-icon-wrap {
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 183, 240, 0.28);
}

.ai-tab-item.active .ai-tab-label {
  color: #0086b3;
  font-weight: 700;
}

.ai-tab-icon {
  font-size: 20px;
  line-height: 1;
}

.ai-tab-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
  letter-spacing: -0.01em;
}

/* 兼容旧类名 */
.ai-tab-bar { display: none; }

.gen-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.gen-panel-inner {
  margin: 10px 14px 18px;
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.gen-text-result {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.pool-block.hidden { display: none; }

.hidden { display: none !important; }

/* legacy ai-subnav removed */
.ai-subnav {
  display: none;
}

.mode-row {
  display: flex;
  gap: 4px;
  margin: 10px 12px 0;
  padding: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.mode-row > span:first-child {
  display: none;
}

.mode-pill {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: none;
  transition: all 0.22s ease;
  text-align: center;
}

.mode-pill.active {
  background: linear-gradient(135deg, #00b7f0, #0099cc);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 183, 240, 0.35);
}

.mode-pill.cloud.active,
.mode-pill[data-mode-val="intranet"].active {
  background: linear-gradient(135deg, #00b7f0, #33c5f3);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 183, 240, 0.35);
}

.stats-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  background: transparent;
}

.pool-block {
  margin: 8px 12px 0;
  padding: 4px 0 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pool-block .stats-row {
  padding-top: 12px;
}

.pool-block .field.compact {
  padding: 0 12px 10px;
}

.pool-block .nodes-fold {
  margin: 0 12px 10px;
}

.stat-chip {
  flex: 1;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.stat-chip .lbl {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat-chip.low-balance span:last-child { color: var(--danger); }

.field.compact {
  padding: 0 12px 10px;
  background: transparent;
}

.field.compact select {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nodes-fold {
  background: transparent;
  margin: 0 12px 10px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.nodes-fold summary {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nodes-fold summary::-webkit-details-marker { display: none; }

.nodes-box {
  padding: 0 8px 10px;
  max-height: 220px;
  overflow-y: auto;
}

.m-node-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.m-node-card:active {
  transform: scale(0.99);
}

.m-node-card.auto {
  background: linear-gradient(135deg, rgba(0, 183, 240, 0.08), rgba(0, 183, 240, 0.04));
  border-color: rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.m-node-card.selected {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
  background: var(--primary-soft);
}

.m-node-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.m-node-title { font-weight: 600; margin-bottom: 4px; }
.m-node-meta { font-size: 11px; color: var(--muted); }
.m-node-badge { display: inline-block; margin-top: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: #047857; }

#chatPoolBlock.hidden,
#imagePoolBlock.hidden,
#imageNegativeField.hidden { display: none; }

.image-panel { padding-top: 0; }

/* Chat */
.chat-scroll-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.chat-body {
  flex: none;
  overflow: visible;
  padding: 12px;
  min-height: 120px;
}

.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.msg-row.user .msg-avatar {
  background: linear-gradient(135deg, #00b7f0, #33c5f3);
  color: #fff;
}

.msg-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #33c5f3, #00b7f0);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 183, 240, 0.3);
}

.chat-input-bar {
  flex-shrink: 0;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 42px;
  max-height: 100px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input-bar textarea:focus {
  outline: none;
  border-color: rgba(0, 183, 240, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 183, 240, 0.12);
  background: #fff;
}

.btn-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b7f0, #33c5f3);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(0, 183, 240, 0.4);
  transition: transform 0.15s ease;
}

.btn-send:active {
  transform: scale(0.94);
}

.btn-send:disabled { opacity: 0.5; }

/* Image gen */
.image-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field select,
.field textarea,
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select:focus,
.field textarea:focus,
.field input:focus {
  outline: none;
  border-color: rgba(0, 183, 240, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 183, 240, 0.1);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #00b7f0 0%, #0099cc 100%);
  box-shadow: 0 8px 24px rgba(0, 183, 240, 0.35);
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.field textarea { min-height: 88px; resize: vertical; }

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.btn-primary:disabled { opacity: 0.55; }

.gen-result {
  margin-top: 16px;
  text-align: center;
}

.gen-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.gen-result img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gen-status {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #00b7f0, #33c5f3);
  border-radius: 999px;
  transition: width 0.3s;
}

/* Tasks */
.tasks-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.task-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.task-type {
  font-size: 14px;
  font-weight: 600;
}

.task-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

.task-status.success { background: #ecfdf5; color: #047857; }
.task-status.running, .task-status.pending { background: #eff6ff; color: #1d4ed8; }
.task-status.failed, .task-status.timeout { background: #fef2f2; color: var(--danger); }

.task-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.task-thumb {
  margin-top: 8px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  width: 100%;
}

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

/* Me */
.me-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.me-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.me-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b7f0, #33c5f3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(0, 183, 240, 0.35);
}

.me-balance { font-size: 30px; font-weight: 800; color: var(--primary-dark); margin: 8px 0; letter-spacing: -0.03em; }

.me-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.me-label { font-size: 13px; color: var(--muted); }

.me-link {
  display: block;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.me-link:active {
  transform: scale(0.99);
}

.btn-logout {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(254, 242, 242, 0.9);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.pwa-tip {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #92400e;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

/* Bottom nav — 毛玻璃底栏 */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
  gap: 0;
}

.bottom-nav button {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 0;
  position: relative;
  transition: color 0.2s ease;
  min-width: 0;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  transform: translateZ(0);
}

.bottom-nav button .icon {
  font-size: 22px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav button.active {
  color: var(--primary-dark);
}

.bottom-nav button.active .icon {
  transform: scale(1.12);
}

.bottom-nav button.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00b7f0, #33c5f3);
}

.hidden { display: none !important; }

.ai-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.ai-view.gen-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.ai-view#view-chat.active {
  display: flex;
}

.ai-view.gen-scroll.active {
  display: block;
}

/* Auth pages (/m/login, /m/register) */
body.auth-page {
  overflow: auto;
  background: var(--bg);
  background-image: var(--bg-soft);
}

.auth-header {
  position: relative;
  padding: calc(24px + var(--safe-t)) 20px 36px;
  background: linear-gradient(135deg, #0099cc 0%, #00b7f0 55%, #33c5f3 100%);
  color: #fff;
  box-shadow: 0 4px 24px rgba(0, 183, 240, 0.35);
}

.auth-back {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 12px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-brand h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-card {
  flex: 1;
  margin: -20px 16px 24px;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.auth-card h2 {
  margin: 0 0 22px;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: #f8fafc;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(0, 183, 240, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 183, 240, 0.12);
  background: #fff;
}

.auth-shell {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.auth-brand {
  text-align: center;
  padding-top: 8px;
}

.auth-brand p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
}

.auth-msg {
  min-height: 20px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-msg.error { color: var(--danger); }
.auth-msg.success { color: var(--accent); }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.auth-field .optional {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.auth-submit {
  margin-top: 6px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

.auth-submit:disabled {
  opacity: 0.7;
}

.auth-footer {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}


/* —— 创作中心完整三路线面板（对齐桌面 /chat） —— */
.m-chat-panel-head {
  margin: 10px 12px 0;
  padding: 14px 14px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.m-chat-panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.m-chat-panel-head strong {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.m-chat-route-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 650;
  color: #0086b3;
  background: #e8f8fd;
  border: 1px solid #b3e7f8;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.m-chat-panel-head p {
  margin-top: 8px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.55;
}

.m-route-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 12px 0;
}

.m-route-card {
  width: 100%;
  text-align: left;
  padding: 14px 14px 12px;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #eef0f4;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.m-route-card.active {
  border-color: #00b7f0;
  background: #e8f8fd;
}

.m-route-title {
  font-size: 15px;
  font-weight: 650;
  color: #111827;
  margin-bottom: 6px;
}

.m-route-card.active .m-route-title {
  color: #0086b3;
}

.m-route-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.55;
}

.m-route-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.m-route-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 183, 240, 0.12);
  color: #0099cc;
}

.m-route-tag.tone-cafe {
  background: rgba(0, 153, 204, 0.10);
  color: #0077a3;
}

.m-route-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef0f4;
}

.m-route-card.active .m-route-stats {
  border-top-color: #b3e7f8;
}

.m-route-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-route-stat strong {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.m-route-card.active .m-route-stat strong {
  color: #0086b3;
}

.m-route-stat span {
  font-size: 11px;
  color: #94a3b8;
}

.pool-block.m-pool-full {
  margin-top: 10px;
  padding: 12px;
}

.m-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 12px;
  border-radius: 12px;
  background: #e8f8fd;
  border: 1px solid #b3e7f8;
  font-size: 12px;
  color: #0369a1;
  line-height: 1.45;
}

.m-info-bar strong {
  color: #0c4a6e;
  font-weight: 700;
}

.m-zone-pick {
  margin-top: 14px;
}

.m-zone-pick .zone-head h3 {
  font-size: 15px;
  font-weight: 650;
  color: #111827;
  margin: 0 0 4px;
}

.m-zone-pick .zone-head p {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 12px;
  line-height: 1.45;
}

.m-zone-region-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.m-zone-region-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.m-zone-chip {
  appearance: none;
  border: 1px solid #eef0f4;
  background: #fff;
  color: #111827;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.m-zone-chip.active {
  border-color: #00b7f0;
  background: #e8f8fd;
  color: #0086b3;
}

.m-zone-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.m-zone-server-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m-zone-server {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  border: 1px solid #eef0f4;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.m-zone-server.active {
  border-color: #00b7f0;
  background: #e8f8fd;
}

.m-zone-server:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.m-zone-server strong {
  font-size: 14px;
  font-weight: 650;
  color: #111827;
}

.m-zone-server.active strong {
  color: #0086b3;
}

.m-zone-server .desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.m-zone-server .meta {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.m-zone-server.active .meta {
  color: #0099cc;
}

.m-zone-hint {
  margin-top: 10px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
}

.m-nodes-section {
  margin-top: 16px;
}

.m-nodes-title {
  font-size: 14px;
  font-weight: 650;
  color: #475569;
  margin-bottom: 10px;
}

.m-pool-full .m-node-card.auto {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid #00b7f0;
  background: #f0faff;
  border-color: #b3e7f8;
}

.m-node-auto-main {
  min-width: 0;
  flex: 1;
}

.m-node-status {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 650;
  color: #0099cc;
  background: #e8f8fd;
  border-radius: 999px;
  padding: 3px 8px;
}

.m-model-hint {
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.m-pool-full .field.compact {
  padding: 14px 0 0;
}

.m-pool-full.hidden {
  display: none !important;
}


/* 十大类目：2 行 × 5 列，图标在上（对齐桌面第二图） */
.ai-tab-section {
  max-height: none;
  overflow: visible;
}
.ai-tab-grid--pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
}
.ai-tab-grid--pills .ai-tab-item {
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 10px 4px;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}
.ai-tab-grid--pills .ai-tab-icon-wrap {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}
.ai-tab-grid--pills .ai-tab-icon { font-size: 20px; line-height: 1; }
.ai-tab-grid--pills .ai-tab-label {
  font-size: 11px;
  font-weight: 650;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0;
  line-height: 1.2;
}
.ai-tab-grid--pills .ai-tab-item.active {
  border-color: #00b7f0;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 183, 240, 0.2);
}
.ai-tab-grid--pills .ai-tab-item.active .ai-tab-label {
  color: #00b7f0;
}
.ai-tab-grid--pills .ai-tab-item.active .ai-tab-icon-wrap {
  transform: none;
  box-shadow: none;
  background: transparent !important;
}
.ai-tab-desc { display: none !important; }
.ai-tab-grid--10 { display: none; }

/* ===== 四模块：创作/Agent/机器人 + 我的·合伙人 ===== */
.hub-panel {
  padding: 14px 14px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
.hub-hero {
  background: linear-gradient(135deg, #e8f8fe 0%, #fff 55%, #f0f7ff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.hub-hero--robot {
  background: linear-gradient(135deg, #eef9f3 0%, #fff 60%, #f3faf7 100%);
}
.hub-hero-title {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.hub-hero-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.hub-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.hub-card {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}
.hub-card:active { transform: scale(0.99); }
.hub-card-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.04em;
}
.hub-card strong {
  font-size: 15px;
  color: var(--text);
}
.hub-card span:last-child {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.hub-note {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(0, 183, 240, 0.06);
  border-radius: var(--radius-sm);
}
.hub-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.hub-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.hub-stat strong {
  display: block;
  font-size: 18px;
  color: var(--primary-dark);
  margin-bottom: 2px;
}
.hub-stat span {
  font-size: 11px;
  color: var(--muted);
}
.hub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}
.hub-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.hub-list-item span { color: var(--muted); font-size: 12px; }
.hub-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.hub-text-btn {
  border: none;
  background: transparent;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 650;
  padding: 6px 0;
}
.me-section {
  margin: 14px 0;
}
.me-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin: 0 0 8px 4px;
}
.partner-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.partner-status {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  margin-bottom: 6px;
}
.partner-meta {
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
  margin-bottom: 10px;
}
.partner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.me-link--inline {
  flex: 1;
  min-width: 140px;
  margin: 0 !important;
  text-align: center;
}
.me-link--btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.btn-primary--sm {
  padding: 10px 14px !important;
  font-size: 13px !important;
  border-radius: 10px !important;
  width: auto !important;
  flex-shrink: 0;
}

/* Agent 内嵌完整对话：壳层顶栏收起，把高度留给 iframe 内对话/工作室/执行台 */
body.tab-agent .app-header {
  display: none;
}
.panel[data-panel="agent"] {
  padding: 0 !important;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.agent-embed-wrap {
  flex: 1;
  height: 100%;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f5f6fa;
}
.agent-embed-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}
