:root {
  --bg: #1a1a2e;
  --card: #16213e;
  --accent: #e94560;
  --green: #0f3460;
  --text: #eaeaea;
  --muted: #8892a0;
  --border: #2a2a4a;
  --income: #4ecca3;
  --expense: #e94560;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶栏 ===== */
.header {
  padding: 16px 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header-actions { display: flex; gap: 12px; }
.header-actions button {
  background: none; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.header-actions button:hover { color: var(--text); background: var(--card); }

/* ===== 月度概览 ===== */
.month-summary {
  margin: 0 20px 16px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  display: flex;
  justify-content: space-around;
  text-align: center;
}
.month-summary .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.month-summary .amount { font-size: 18px; font-weight: 700; }
.month-summary .expense .amount { color: var(--expense); }
.month-summary .income .amount { color: var(--income); }
.month-summary .net .amount { color: var(--text); }

/* ===== 输入区 ===== */
.input-area {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input-row input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.input-row input:focus { border-color: var(--accent); }
.input-row input::placeholder { color: var(--muted); }

#voiceBtn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
#voiceBtn.recording { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

#sendBtn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 解析预览 */
.parse-preview {
  margin-top: 8px;
  padding: 8px 16px;
  background: var(--card);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  display: none;
}
.parse-preview.show { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.parse-preview .tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.parse-preview .cat-tag { background: var(--green); color: white; }
.parse-preview .amt-tag { background: var(--accent); color: white; }
.parse-preview .type-tag { background: var(--income); color: #111; }

/* ===== 分类筛选 ===== */
.filter-bar {
  padding: 8px 20px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== 记录列表 ===== */
.records {
  padding: 8px 20px 100px;
}
.day-group { margin-bottom: 16px; }
.day-header {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0 4px;
  display: flex;
  justify-content: space-between;
}
.day-header .day-total { font-weight: 600; }

.record-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.record-item:last-child { border-bottom: none; }
.record-icon { font-size: 20px; width: 32px; text-align: center; flex-shrink: 0; }
.record-info { flex: 1; min-width: 0; }
.record-category { font-size: 14px; font-weight: 500; }
.record-note { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-amount { font-size: 16px; font-weight: 700; text-align: right; flex-shrink: 0; }
.record-amount.expense { color: var(--expense); }
.record-amount.income { color: var(--income); }

.record-item .delete-btn {
  background: none; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 4px; opacity: 0;
  transition: opacity 0.2s;
}
.record-item:hover .delete-btn,
.record-item:active .delete-btn { opacity: 1; }

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ===== 弹出面板 ===== */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 100; display: none;
}
.panel-overlay.show { display: block; }

.panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 80vh;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  z-index: 101;
  transform: translateY(100%);
  transition: transform 0.3s;
  overflow-y: auto;
}
.panel.show { transform: translateY(0); }
.panel-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card);
}
.panel-header h2 { font-size: 16px; }
.panel-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.panel-body { padding: 16px 20px; }

/* 设置面板 */
.setting-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 14px; margin-bottom: 6px; }
.setting-desc { font-size: 12px; color: var(--muted); }
.setting-item button, .setting-item select {
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

/* ===== 响应式 ===== */
@media (min-width: 600px) {
  body { max-width: 480px; margin: 0 auto; }
}
