/* 517工作台 - 清新白色主题 v3.0 */
:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-2: #f1f5f9;
  --bg-input: #f1f5f9;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.12);
  --primary-dark: #2563eb;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.1);
  --text: #1e293b;
  --text-dim: #64748b;
  --text-faint: #94a3b8;
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.1);
  --red: #ef4444;
  --orange: #f59e0b;
  --orange-glow: rgba(245, 158, 11, 0.1);
  --pink: #ec4899;
  --pink-glow: rgba(236, 72, 153, 0.1);
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.1);
  --border: rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* 背景微光效果 */
body::before {
  content: '';
  position: fixed; top: -30%; left: -10%;
  width: 50%; height: 60%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: '';
  position: fixed; bottom: -20%; right: -10%;
  width: 50%; height: 60%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

.mono, .num { font-family: "SF Mono", "Cascadia Code", Consolas, monospace; }

/* 顶部 */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.app-title {
  font-size: 20px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--pink));
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}
.header-row { display: flex; justify-content: space-between; align-items: center; }
.header-settings {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  width: 34px; height: 34px; border-radius: 10px; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.header-settings:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.header-settings:active { transform: scale(.92); }
.app-date { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* 主体 */
.app-main {
  padding: 14px 14px 120px;
  min-height: calc(100vh - 140px);
  max-width: 640px;
  margin: 0 auto;
  position: relative; z-index: 1;
}
.loading { text-align: center; color: var(--text-faint); padding: 40px 0; }

/* 底部导航 */
.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}
.nav-item {
  flex: 1; background: none; border: none; color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; cursor: pointer; transition: var(--transition);
  font-size: 11px; position: relative;
}
.nav-icon { font-size: 20px; line-height: 1; transition: var(--transition); }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon {
  transform: translateY(-2px) scale(1.1);
}
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 6px var(--primary-glow);
}
.nav-item:active .nav-icon { transform: scale(.9); }

/* 子导航条 */
.sub-nav {
  position: fixed; bottom: 60px; left: 0; right: 0; z-index: 19;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 10px;
  display: none;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
}
.sub-nav.show { display: block; animation: slideUp .2s ease; }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sub-nav-inner {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sub-nav-inner::-webkit-scrollbar { display: none; }
.sub-nav-item {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 14px; border-radius: 16px; font-size: 12px; white-space: nowrap;
  cursor: pointer; transition: var(--transition); flex-shrink: 0;
}
.sub-nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary); font-weight: 600;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  animation: cardFadeIn .35s ease;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:active { transform: scale(.99); }
.card-title {
  font-size: 14px; color: var(--text); margin-bottom: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title .badge { font-size: 11px; color: var(--primary); font-weight: 500; }

/* 网格 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 360px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

/* 统计块 */
.stat {
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 12px 10px;
  text-align: center; transition: var(--transition); border: 1px solid transparent;
}
.stat:active { transform: scale(.95); border-color: var(--border); }
.stat-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-label { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* 按钮 */
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none;
  padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: var(--transition); width: 100%;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.btn:active { transform: scale(.97); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn.ghost:active { background: var(--primary-glow); }
.btn.danger { background: linear-gradient(135deg, var(--red), #dc2626); color: #fff; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15); }
.btn.small { width: auto; padding: 6px 12px; font-size: 12px; }

/* 输入 */
input, select, textarea {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; width: 100%;
  font-family: inherit; transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
  background: #fff;
}
label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.field { margin-bottom: 10px; }

/* 列表 */
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.list-item:active { padding-left: 4px; }
.list-item:last-child { border-bottom: none; }
.list-main { flex: 1; }
.list-title { font-size: 14px; }
.list-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.list-amount { font-size: 15px; font-weight: 600; }

/* 标签 */
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; background: rgba(59,130,246,0.08); color: var(--primary);
  font-weight: 500;
}
.tag.green { background: rgba(16,185,129,0.1); color: var(--green); }
.tag.red { background: rgba(239,68,68,0.1); color: var(--red); }
.tag.orange { background: rgba(245,158,11,0.1); color: var(--orange); }
.tag.purple { background: rgba(139,92,246,0.1); color: var(--accent); }

/* 进度条 */
.progress { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px; transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

/* 抽屉 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  backdrop-filter: blur(2px);
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.more-drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: #fff;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  max-height: 70vh; overflow-y: auto; padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
}
.more-drawer.show { transform: translateY(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.drawer-header h2 { font-size: 16px; }
.drawer-close { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.drawer-item {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 6px; text-align: center; cursor: pointer; transition: var(--transition);
}
.drawer-item:active { border-color: var(--primary); transform: scale(.95); }
.drawer-icon { font-size: 22px; margin-bottom: 4px; }
.drawer-name { font-size: 12px; color: var(--text-dim); }

/* 复选框 */
.check {
  width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
}
.check.on { background: var(--primary); border-color: var(--primary); }
.check.on::after { content: "✓"; color: #fff; font-size: 13px; font-weight: bold; }

/* 空状态 */
.empty { text-align: center; padding: 30px 0; color: var(--text-faint); }
.empty-icon { font-size: 36px; opacity: 0.4; margin-bottom: 8px; }
.empty-text { font-size: 13px; }

/* 段落标题 */
.section-title { font-size: 14px; color: var(--text); margin: 16px 0 8px; font-weight: 600; }

/* Tab 切换 */
.tab-bar { display: flex; background: var(--bg-input); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.tab-bar button {
  flex: 1; background: none; border: none; color: var(--text-dim);
  padding: 8px; border-radius: 7px; font-size: 13px; cursor: pointer; transition: var(--transition);
}
.tab-bar button.active {
  background: #fff; color: var(--primary); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* 图表容器 */
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }

/* 工具栏 */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }

/* 提示 */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 9px 18px;
  border-radius: 20px; font-size: 13px; font-weight: 600; z-index: 50;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* 安装提示 */
.install-banner {
  position: fixed; bottom: 70px; left: 12px; right: 12px;
  background: #fff;
  border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; display: none; align-items: center; gap: 10px; z-index: 25;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.install-banner.show { display: flex; animation: slideUp .3s ease; }
.install-banner .txt { flex: 1; font-size: 12px; }
.install-banner .txt b { color: var(--primary); }

/* Hero卡片（首页问候） */
.hero-card {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 50%, #fce7f3 100%);
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 18px;
  padding: 18px 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute; top: -50%; right: -20%;
  width: 50%; height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
  pointer-events: none;
}
.hero-greeting { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; position: relative; }
.hero-greeting .wave { display: inline-block; animation: wave 2s ease infinite; transform-origin: 70% 70%; }
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(15deg); }
  80% { transform: rotate(-5deg); }
}
.hero-sub { font-size: 13px; color: var(--text-dim); position: relative; }
.hero-quote {
  font-size: 12px; color: var(--text-faint); margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06); position: relative;
  font-style: italic;
}

/* 快速入口格子 */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.quick-item {
  background: var(--bg-input); border-radius: 12px; padding: 12px 6px;
  text-align: center; cursor: pointer; transition: var(--transition);
  border: 1px solid transparent;
}
.quick-item:active { transform: scale(.92); border-color: var(--border); }
.quick-item .icon { font-size: 24px; margin-bottom: 4px; }
.quick-item .label { font-size: 10px; color: var(--text-dim); }

/* 任务卡片 */
.task-card { transition: var(--transition); }
.task-card:active { transform: scale(.98); }

/* 聊天气泡 */
.chat-bubble { animation: bubbleIn .3s ease; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
