:root {
  --bg: #0f0f14;
  --bg-card: #1a1a24;
  --bg-input: #252535;
  --border: #2a2a3a;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --accent: #6c8cff;
  --accent-hover: #8aa4ff;
  --danger: #ff5c6c;
  --danger-hover: #ff7d8a;
  --green: #4ade80;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

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

/* ── 侧边栏 ─────────────────────── */

.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.logo {
  padding: 20px 16px 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-item:hover { background: var(--bg-input); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--danger); }

/* ── 主区域 ─────────────────────── */

.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  max-width: 900px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

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

.tab-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

/* ── 添加行 ─────────────────────── */

.add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.add-row input {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.15s;
}

.add-row input:focus { border-color: var(--accent); }
.add-row input::placeholder { color: #555; }

/* ── 按钮 ──────────────────────── */

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
}
.btn-danger:hover { background: rgba(255,92,108,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── 待办统计卡片 ──────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-card.active { border-color: var(--accent); background: rgba(108,140,255,0.08); }

.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

.stat-card.overdue-highlight .stat-num { color: var(--danger); }
.stat-card.overdue-highlight.active { border-color: var(--danger); background: rgba(255,92,108,0.08); }

/* ── 待办工具栏 ──────────────── */

.todo-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.15s;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: #555; }

.filter-select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  min-width: 120px;
}

/* ── 添加表单 ──────────────── */

.todo-add-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.todo-add-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  margin-bottom: 10px;
  transition: border 0.15s;
}

.todo-add-input:focus { border-color: var(--accent); }
.todo-add-input::placeholder { color: #555; }

.todo-add-options {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-select {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.mini-date {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.mini-date:focus { border-color: var(--accent); }

/* ── 待办列表 ───────────────── */

.todo-list, .note-list, .bookmark-list, .rss-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

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

.todo-item.priority-high::before { background: #ff5c6c; }
.todo-item.priority-medium::before { background: #fbbf24; }
.todo-item.priority-low::before { background: #6b7280; }

.todo-item.overdue { border-color: rgba(255,92,108,0.3); background: rgba(255,92,108,0.03); }

.todo-item:hover { border-color: #444; transform: translateX(2px); }
.todo-item.completed { opacity: 0.55; }

.todo-item.completed .todo-check {
  background: var(--green);
  border-color: var(--green);
}

/* 完成动画 */
@keyframes checkIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.todo-item.completed .todo-check svg {
  animation: checkIn 0.3s ease-out;
}

.todo-check {
  width: 22px; height: 22px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

.todo-check:hover { border-color: var(--accent); transform: scale(1.1); }

.todo-body { flex: 1; min-width: 0; }

.todo-content {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.todo-item.completed .todo-content {
  text-decoration: line-through;
  color: var(--text-dim);
}

.todo-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

.todo-category {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-dim);
}

.todo-due {
  font-size: 11px;
  color: var(--text-dim);
}

.todo-due.overdue-text { color: var(--danger); font-weight: 600; }

.todo-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.todo-item:hover .todo-actions { opacity: 1; }

.todo-action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.15s;
}

.todo-action-btn:hover { background: var(--bg-input); color: var(--text); }
.todo-action-btn.danger:hover { color: var(--danger); }

/* ── 响应式统计卡片 ──────────── */

@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .todo-toolbar { flex-direction: column; }
  .todo-add-options { flex-direction: column; align-items: stretch; }
}

/* ── 笔记列表 ───────────────────── */

.note-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.note-item:hover { border-color: #444; }

.note-item-title {
  font-size: 15px;
  font-weight: 500;
}

.note-item-date {
  font-size: 12px;
  color: var(--text-dim);
}

.note-editor {
  margin-bottom: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.note-editor.hidden { display: none; }

.note-editor input,
.note-editor textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
  resize: vertical;
}

.note-editor input:focus,
.note-editor textarea:focus { border-color: var(--accent); }

.note-actions { display: flex; gap: 8px; }

/* ── 书签列表 ───────────────────── */

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}

.bookmark-item:hover { border-color: #444; }

.bm-link {
  flex: 1;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.bm-link:hover { text-decoration: underline; }

.bm-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bm-tag {
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ── RSS 列表 ───────────────────── */

.rss-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}

.rss-item:hover { border-color: #444; }

.rss-item-name {
  font-weight: 500;
  font-size: 14px;
}

.rss-item-url {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 空状态 ─────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── 响应式 ─────────────────────── */

@media (max-width: 640px) {
  .sidebar { width: 60px; }
  .logo { font-size: 14px; padding: 16px 8px; text-align: center; }
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-footer span { display: none; }
  .main { padding: 16px; }
  .add-row { flex-direction: column; }
}

/* ── RSS 文章列表 ────────────────── */

.rss-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.rss-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.rss-feed-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rss-feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.rss-feed-item:hover { border-color: #444; }

.rss-feed-info { flex: 1; min-width: 0; }

.rss-feed-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.rss-feed-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.rss-feed-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.rss-article-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rss-article-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}

.rss-article-item:hover { border-color: #444; }

.rss-article-item.unread {
  border-left: 3px solid var(--accent);
}

.rss-article-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

.rss-article-dot.read { background: transparent; }

.rss-article-content { flex: 1; min-width: 0; }

.rss-article-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}

.rss-article-title:hover { color: var(--accent); }

.rss-article-summary {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rss-article-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.rss-article-feed {
  color: var(--accent);
  font-size: 11px;
}
