:root {
  --page-bg: #f4f3f0;
  --surface-card: #fcfbf8;
  --surface-nested: #f7f6f1;
  --border: #e8e6df;
  --border-input: #d4d1c8;
  --text: #232220;
  --text-secondary: #6b665d;
  --text-tertiary: #8c877c;
  --accent: #2f2e2b;
  --accent-muted: #efeee8;
  --on-accent: #f4f3f0;
  --module-1: #6a9a7a;
  --module-2: #7a8da3;
  --module-3: #c4a572;
  --module-4: #b8837a;
  --module-5: #a09ab5;
  --danger: #c0392b;
  --danger-muted: #f5e6e3;
  --success: #2d7a4f;
  --success-muted: #e6f0ea;
  --warning: #b8860b;
  --warning-muted: #f5edd6;
  --info: #345b8c;
  --info-muted: #e6ecf5;
  --drawer-bg: #232220;
  --drawer-bg-top: #2d2c29;
  --drawer-text: #f4f3f0;
  --drawer-text-mute: #8c877c;
  --drawer-hover: #2d2c29;
  --drawer-active: #3a3835;
  --radius-control: 6px;
  --radius-tile: 10px;
  --radius-card: 14px;
  --radius-sheet: 20px;
  --shadow-card: 0 2px 8px rgba(35,34,32,0.06);
  --shadow-overlay: 0 8px 32px rgba(35,34,32,0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --sidebar-w: 240px;
  --nav-h: 0px;
}

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

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 14px;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--drawer-bg);
  color: var(--drawer-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-tile);
  background: linear-gradient(135deg, var(--module-2), var(--module-5));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; color: var(--drawer-text); }
.brand-sub { font-size: 12px; color: var(--drawer-text-mute); margin-top: 2px; }

.nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-tile);
  color: var(--drawer-text-mute);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--drawer-hover);
  color: var(--drawer-text);
}

.nav-item.active {
  background: var(--drawer-active);
  color: var(--drawer-text);
}

.nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}

.nav-item .label { flex: 1; }

.nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 14px; }
.nav-section-title { font-size: 11px; color: var(--drawer-text-mute); text-transform: uppercase; letter-spacing: 1px; padding: 4px 14px 8px; font-weight: 600; opacity: 0.6; }

.nav-badge {
  font-size: 11px;
  background: var(--module-1);
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--drawer-text-mute);
  line-height: 1.7;
}

/* ===== 主内容区 ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 48px;
  max-width: calc(100% - var(--sidebar-w));
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 24px; }

.page h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.desc label { color: var(--text); font-weight: 500; cursor: pointer; }

/* ===== 卡片 ===== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group textarea,
#batchQueryArea textarea,
#aiSettings .form-group input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-nested);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-tile);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
#batchQueryArea textarea:focus,
#aiSettings .form-group input[type="text"]:focus {
  border-color: var(--text-secondary);
  background: var(--surface-card);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group input[type="text"]::placeholder,
.form-group textarea::placeholder,
#batchQueryArea textarea::placeholder {
  color: var(--text-tertiary);
}

.form-group textarea { resize: vertical; min-height: 200px; line-height: 1.8; }

.form-tip { font-size: 12px; color: var(--text-tertiary); margin-top: 5px; }

.form-row { display: flex; gap: 16px; margin-bottom: 0; }
.form-row .form-group { flex: 1; min-width: 0; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-tile);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { background: #3a3835; transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface-nested);
  color: var(--text);
  border-color: var(--border-input);
}
.btn-secondary:hover { background: var(--accent-muted); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #a93226; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #246840; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== 查询栏 ===== */
.query-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.query-bar input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 11px 16px;
  background: var(--surface-nested);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-tile);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.query-bar input[type="text"]:focus {
  border-color: var(--text-secondary);
  background: var(--surface-card);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.query-bar input[type="text"]::placeholder { color: var(--text-tertiary); }

input[type="radio"] { accent-color: var(--accent); }

a.link-btn {
  font-size: 13px;
  color: var(--info);
  cursor: pointer;
  text-decoration: none;
}
a.link-btn:hover { text-decoration: underline; }

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface-card);
}

.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table-wrap th {
  background: var(--surface-nested);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table-wrap td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap tr:hover td { background: var(--accent-muted); }
.table-wrap tr:last-child td { border-bottom: none; }

/* ===== 模态框 ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(35,34,32,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: modalFade 0.2s ease;
}

@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  padding: 32px;
  max-width: 960px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-overlay);
  animation: modalSlide 0.25s ease;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-sm .modal-content { max-width: 700px; }

.modal-close {
  position: absolute;
  right: 20px; top: 16px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-tertiary);
  line-height: 1;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
}

.modal-close:hover { color: var(--text); background: var(--surface-nested); }

.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.modal h4 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-top: 18px; margin-bottom: 10px; }

/* ===== 消息提示 ===== */
.result-summary {
  font-size: 14px;
  padding: 14px 18px;
  background: var(--success-muted);
  border: 1px solid rgba(45,122,79,0.25);
  border-radius: var(--radius-tile);
  margin: 14px 0;
  color: var(--text);
}
.result-summary strong { color: var(--success); font-size: 16px; }

.msg-info {
  padding: 14px 18px;
  background: var(--info-muted);
  border: 1px solid rgba(52,91,140,0.25);
  border-radius: var(--radius-tile);
  color: var(--info);
}

.msg-error {
  padding: 14px 18px;
  background: var(--danger-muted);
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: var(--radius-tile);
  color: var(--danger);
}

#failedDetail {
  margin: 14px 0;
  padding: 14px 18px;
  background: var(--danger-muted);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: var(--radius-tile);
}
#failedDetail p { font-weight: 600; color: var(--danger); margin-bottom: 8px; }
#failedList { margin-left: 20px; color: var(--danger); font-size: 13px; line-height: 2; }

/* ===== 首页 ===== */
.greet {
  background: linear-gradient(135deg, var(--drawer-bg), var(--drawer-bg-top));
  color: var(--drawer-text);
  border-radius: var(--radius-card);
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.greet::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(106,154,122,0.2), transparent 70%);
  border-radius: 50%;
}

.greet h2 { color: var(--drawer-text); font-size: 26px; margin-bottom: 8px; position: relative; z-index: 1; }
.greet p { color: var(--drawer-text-mute); font-size: 14px; position: relative; z-index: 1; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }

.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.stat-card.s1::before { background: var(--module-1); }
.stat-card.s2::before { background: var(--module-2); }
.stat-card.s3::before { background: var(--module-3); }
.stat-card.s4::before { background: var(--module-4); }

.stat-label { color: var(--text-secondary); font-size: 12px; font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-sub { color: var(--text-tertiary); font-size: 11px; margin-top: 4px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.module-tile {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 14px;
}

.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--text-tertiary); }

.module-tile-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-tile);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  color: #fff;
}

.module-tile-info { flex: 1; min-width: 0; }
.module-tile-name { font-size: 14px; font-weight: 600; color: var(--text); }
.module-tile-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* 概览统计行 */
.overview-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ov-item { flex: 1; min-width: 100px; text-align: center; padding: 16px 8px; background: var(--surface-nested); border-radius: var(--radius-tile); transition: all 0.15s ease; cursor: pointer; }
.ov-item:hover { background: var(--accent-muted); transform: translateY(-2px); }
.ov-num { display: block; font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.2; }
.ov-label { display: block; font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ===== KPI 卡片（数据看板） ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }

.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.kpi-blue::before { background: var(--module-2); }
.kpi-green::before { background: var(--module-1); }
.kpi-orange::before { background: var(--module-3); }
.kpi-purple::before { background: var(--module-5); }

.kpi-label { color: var(--text-secondary); font-size: 12px; font-weight: 500; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.kpi-value { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1.2; }
.kpi-sub { color: var(--text-tertiary); font-size: 11px; margin-top: 6px; }

/* ===== 图表 ===== */
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  transition: all 0.15s ease;
}
.chart-card:hover { box-shadow: var(--shadow-card); }
.chart-wide { grid-column: 1 / -1; }
.chart-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.chart-area { width: 100%; height: 300px; }

/* ===== 格式学习 ===== */
.learning-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.learning-section { min-height: 400px; }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }

.patterns-list { display: flex; flex-direction: column; gap: 10px; }

.pattern-item {
  background: var(--surface-nested);
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  padding: 14px;
  transition: all 0.15s ease;
  animation: fadeIn 0.3s ease both;
}

.pattern-item:hover { background: var(--surface-card); border-color: var(--text-tertiary); transform: translateY(-1px); }

.pattern-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pattern-name { font-weight: 600; color: var(--text); font-size: 14px; }
.pattern-status { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.status-active { background: var(--success-muted); color: var(--success); }
.status-inactive { background: var(--danger-muted); color: var(--danger); }

.pattern-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.pattern-meta span { display: flex; align-items: center; gap: 3px; }

.pattern-sample {
  background: var(--page-bg);
  border-radius: var(--radius-control);
  padding: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: 'Courier New', monospace;
  max-height: 60px;
  overflow: hidden;
  margin-bottom: 10px;
  line-height: 1.5;
}

.pattern-actions { display: flex; gap: 6px; }
.pattern-actions button {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--text-secondary);
}
.pattern-actions button:hover { background: var(--accent-muted); color: var(--text); }
.pattern-actions .btn-enable { color: var(--success); }
.pattern-actions .btn-disable { color: var(--warning); }
.pattern-actions .btn-delete { color: var(--danger); }

.analysis-result { animation: fadeIn 0.3s ease both; }
.analysis-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.analysis-stat { background: var(--surface-nested); border-radius: var(--radius-tile); padding: 12px; text-align: center; }
.analysis-stat-value { font-size: 20px; font-weight: 700; color: var(--module-2); }
.analysis-stat-label { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; }

.analysis-detail { background: var(--surface-nested); border-radius: var(--radius-tile); padding: 12px; font-size: 13px; }
.analysis-detail h4 { margin: 8px 0 5px; font-size: 13px; color: var(--text-secondary); }
.analysis-detail ul { list-style: none; padding-left: 0; }
.analysis-detail li { padding: 3px 0; color: var(--text); font-size: 12px; }
.analysis-detail li::before { content: "▸ "; color: var(--module-2); }

.parsed-preview { background: var(--success-muted); border: 1px solid rgba(45,122,79,0.25); border-radius: var(--radius-tile); padding: 12px; margin-top: 10px; }
.parsed-preview h4 { color: var(--success); margin-bottom: 6px; }
.parsed-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.parsed-item { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 8px; background: var(--surface-card); border-radius: var(--radius-control); }
.parsed-item .label { color: var(--text-tertiary); }
.parsed-item .value { color: var(--text); font-weight: 500; }

.tips-list { display: flex; flex-direction: column; gap: 8px; }
.tip-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-nested); border-radius: var(--radius-tile); font-size: 13px; color: var(--text-secondary); }
.tip-icon { font-size: 16px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-input); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
::selection { background: var(--accent-muted); color: var(--text); }

/* ===== 待办清单 ===== */
.todo-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-chip { padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); background: var(--surface-card); color: var(--text-secondary); transition: all 0.15s ease; }
.filter-chip:hover { border-color: var(--text-tertiary); }
.filter-chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-tile); transition: all 0.15s ease; }
.todo-item:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); }
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-title { text-decoration: line-through; }
.todo-check { width: 22px; height: 22px; border: 2px solid var(--border-input); border-radius: 50%; cursor: pointer; flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease; }
.todo-check:hover { border-color: var(--module-1); }
.todo-check.checked { background: var(--module-1); border-color: var(--module-1); color: #fff; }
.todo-check.checked::after { content: '✓'; font-size: 14px; font-weight: 700; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 14px; font-weight: 600; color: var(--text); }
.todo-desc { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.todo-meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.tag-high { background: var(--danger-muted); color: var(--danger); }
.tag-medium { background: var(--warning-muted); color: var(--warning); }
.tag-low { background: var(--surface-nested); color: var(--text-tertiary); }
.tag-due { background: var(--info-muted); color: var(--info); }
.tag-cat { background: var(--accent-muted); color: var(--text-secondary); }
.tag-overdue { background: var(--danger); color: #fff; }
.todo-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s ease; }
.todo-item:hover .todo-actions { opacity: 1; }
.todo-actions button { width: 30px; height: 30px; border: none; background: transparent; cursor: pointer; border-radius: 6px; color: var(--text-tertiary); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.todo-actions button:hover { background: var(--surface-nested); color: var(--text); }
.todo-actions .btn-del:hover { color: var(--danger); }
.todo-empty { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.todo-empty .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 记账本 ===== */
.ledger-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.ledger-stat { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px; text-align: center; }
.ledger-stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.ledger-stat-value { font-size: 24px; font-weight: 800; }
.ledger-stat.expense .ledger-stat-value { color: var(--danger); }
.ledger-stat.income .ledger-stat-value { color: var(--success); }
.ledger-stat.balance .ledger-stat-value { color: var(--module-2); }
.ledger-month-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ledger-month-bar input[type="month"] { padding: 8px 12px; border: 1px solid var(--border-input); border-radius: var(--radius-tile); background: var(--surface-nested); font-size: 14px; color: var(--text); outline: none; }
.ledger-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ledger-item:last-child { border-bottom: none; }
.ledger-item:hover { background: var(--accent-muted); }
.ledger-type-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.ledger-type-icon.expense { background: var(--danger-muted); }
.ledger-type-icon.income { background: var(--success-muted); }
.ledger-item-body { flex: 1; min-width: 0; }
.ledger-item-cat { font-size: 14px; font-weight: 600; color: var(--text); }
.ledger-item-note { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.ledger-item-date { font-size: 12px; color: var(--text-tertiary); }
.ledger-item-amount { font-size: 16px; font-weight: 700; }
.ledger-item-amount.expense { color: var(--danger); }
.ledger-item-amount.income { color: var(--success); }

/* ===== 目标追踪 ===== */
.goal-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; margin-bottom: 14px; transition: all 0.15s ease; }
.goal-card:hover { box-shadow: var(--shadow-card); }
.goal-card.done { opacity: 0.6; }
.goal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.goal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.goal-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.goal-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.goal-progress-wrap { margin-top: 8px; }
.goal-progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.goal-progress-bar { height: 10px; background: var(--surface-nested); border-radius: 5px; overflow: hidden; }
.goal-progress-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.goal-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ===== 笔记灵感 ===== */
.note-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.note-toolbar input { flex: 1; min-width: 200px; padding: 10px 14px; border: 1px solid var(--border-input); border-radius: var(--radius-tile); background: var(--surface-nested); font-size: 14px; color: var(--text); outline: none; }
.note-toolbar input:focus { border-color: var(--text-secondary); background: var(--surface-card); }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.note-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; cursor: pointer; transition: all 0.15s ease; position: relative; overflow: hidden; }
.note-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.note-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.note-card.c-yellow::before { background: var(--module-3); }
.note-card.c-green::before { background: var(--module-1); }
.note-card.c-blue::before { background: var(--module-2); }
.note-card.c-red::before { background: var(--module-4); }
.note-card.c-purple::before { background: var(--module-5); }
.note-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; padding-left: 8px; }
.note-card-content { font-size: 13px; color: var(--text-secondary); line-height: 1.6; padding-left: 8px; max-height: 100px; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.note-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-left: 8px; }
.note-card-tags { font-size: 11px; color: var(--text-tertiary); }
.note-card-date { font-size: 11px; color: var(--text-tertiary); }

/* ===== 通用选择框 ===== */
select { padding: 10px 14px; border: 1px solid var(--border-input); border-radius: var(--radius-tile); background: var(--surface-nested); font-size: 14px; color: var(--text); outline: none; font-family: inherit; cursor: pointer; }
select:focus { border-color: var(--text-secondary); background: var(--surface-card); }
input[type="date"], input[type="month"] { padding: 10px 14px; border: 1px solid var(--border-input); border-radius: var(--radius-tile); background: var(--surface-nested); font-size: 14px; color: var(--text); outline: none; font-family: inherit; }
input[type="date"]:focus, input[type="month"]:focus { border-color: var(--text-secondary); background: var(--surface-card); }

/* ===== 移动端适配 ===== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  width: 40px; height: 40px;
  background: var(--drawer-bg);
  color: var(--drawer-text);
  border: none;
  border-radius: var(--radius-tile);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .learning-container { grid-template-columns: 1fr; }
  .analysis-stats { grid-template-columns: repeat(2, 1fr); }
  .parsed-grid { grid-template-columns: 1fr; }
  .ledger-summary { grid-template-columns: 1fr; }
  .note-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 64px 16px 32px; max-width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  .card { padding: 18px 16px; }
  .greet { padding: 24px 20px; }
  .greet h2 { font-size: 22px; }
}
</style>
