* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --primary-light: rgba(102,126,234,0.1);
  --gradient: linear-gradient(135deg, #667eea, #764ba2);
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #f0f0f0;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  max-width: 480px; margin: 0 auto;
  min-height: 100vh; position: relative;
  padding-bottom: 64px;
}

/* Status Bar */
.status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px 6px;
  font-size: 12px; font-weight: 600;
  background: var(--card);
  position: sticky; top: 0; z-index: 100;
}
.status-bar .time { font-size: 14px; }

/* Header */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.app-header h1 { font-size: 18px; font-weight: 700; }
.app-header .header-actions { display: flex; gap: 16px; color: var(--text-secondary); font-size: 18px; }
.app-header .user-badge {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}

/* Bottom Nav */
.bottom-nav {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 0 calc(8px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto; z-index: 200;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--text-muted); cursor: pointer;
  padding: 4px 16px; transition: color 0.2s;
  border: none; background: none;
}
.nav-item .nav-icon { font-size: 22px; line-height: 1; }
.nav-item.active { color: var(--primary); }

/* Page container */
.page {
  display: none; padding: 16px;
}
.page.active { display: block; }

/* Greeting Card */
.greeting-card {
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  margin-bottom: 16px;
}
.greeting-card .greeting-sub { font-size: 13px; opacity: 0.9; }
.greeting-card .greeting-name { font-size: 22px; font-weight: 700; margin: 4px 0 8px; }
.greeting-card .greeting-tasks { font-size: 13px; opacity: 0.85; }

/* Stats Grid */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px; text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-number { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card:nth-child(2) .stat-number { color: #52c41a; }
.stat-card:nth-child(3) .stat-number { color: #faad14; }

/* Chat Entry */
.chat-entry {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  display: block; text-decoration: none; color: inherit;
}
.chat-entry:hover { border-color: var(--primary); }
.chat-entry-inner { display: flex; align-items: center; gap: 12px; }
.chat-entry-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.chat-entry-content { flex: 1; }
.chat-entry-title { font-size: 15px; font-weight: 600; }
.chat-entry-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chat-entry-arrow { color: var(--primary); font-size: 20px; }

/* Section Title */
.section-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 600; margin-bottom: 10px;
}
.section-title .more { font-size: 12px; color: var(--primary); cursor: pointer; }

/* Tool Grid */
.tool-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.tool-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: none;
  transition: transform 0.15s;
}
.tool-item:active { transform: scale(0.96); }
.tool-item .tool-icon { font-size: 28px; }
.tool-item .tool-label { font-size: 12px; color: var(--text); }
.tool-item .tool-badge {
  font-size: 10px; color: #fff; background: #ff4d4f;
  padding: 1px 6px; border-radius: 10px;
  margin-left: 4px;
}

/* Conversation List */
.conv-list {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.conv-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: block; text-decoration: none; color: inherit;
}
.conv-item:last-child { border-bottom: none; }
.conv-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.conv-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== CHAT PAGE ===== */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.chat-header .back-btn {
  font-size: 20px; cursor: pointer; color: var(--text-secondary);
  border: none; background: none; padding: 4px;
}
.chat-header .chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}
.chat-header .chat-user { flex: 1; }
.chat-header .chat-name { font-size: 15px; font-weight: 600; }
.chat-header .chat-status { font-size: 11px; color: #52c41a; }

.messages {
  padding: 16px;
  min-height: calc(100vh - 200px);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  background: #f7f8fa;
}
.message { margin-bottom: 16px; display: flex; }
.message.ai { justify-content: flex-start; }
.message.user { justify-content: flex-end; }
.message .bubble {
  max-width: 82%; padding: 12px 16px;
  border-radius: 16px; font-size: 14px; line-height: 1.65;
  position: relative;
}
.message.ai .bubble {
  background: var(--card);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.message.user .bubble {
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message .time { font-size: 10px; color: #bbb; margin-top: 4px; }
.message.user .time { text-align: right; }

.tag-ai {
  display: inline-block;
  font-size: 10px; color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px; border-radius: 4px;
  margin-bottom: 4px;
}

.typing-dots { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.typing-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ccc; animation: typing 1.4s infinite;
}
.typing-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dots .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100%{opacity:0.3} 30%{opacity:1} }

.chat-input-area {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: var(--card); border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
}
.chat-input-area input {
  flex: 1; padding: 10px 14px;
  border: 1px solid #e8e8e8; border-radius: 20px;
  font-size: 14px; outline: none; background: #f7f8fa;
}
.chat-input-area input:focus { border-color: var(--primary); background: #fff; }
.chat-input-area .send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient); color: #fff; border: none;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.15s;
}
.chat-input-area .send-btn:active { transform: scale(0.92); }
.chat-input-area .send-btn:disabled { opacity: 0.5; }

.stream-cursor::after { content: '▊'; animation: blink 1s step-end infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }

/* My Page */
.my-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.my-card .my-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 600; margin: 0 auto 10px;
}
.my-card .my-name { text-align: center; font-size: 18px; font-weight: 600; }
.my-card .my-phone { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.my-menu { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.my-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.my-menu-item:last-child { border-bottom: none; }
.my-menu-item .menu-icon { font-size: 18px; }
.my-menu-item .menu-label { flex: 1; font-size: 14px; }
.my-menu-item .menu-arrow { color: #ccc; font-size: 16px; }

/* Utility */
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
