/* ===== 认知飞轮 Cognitive Flywheel — Styles ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  background: #f4f0ea;
  color: #231f1a;
  font-size: 14px;
  line-height: 1.6;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Top Bar ===== */
#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #fffdf8;
  border-bottom: 1px solid #e0d6c8;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 18px; font-weight: 700; color: #2d2924; }
.logo-sub { font-size: 11px; color: #a39688; }
.home-btn { text-decoration: none; font-size: 18px; padding: 2px 6px; border-radius: 6px; transition: background 0.12s; color: #2d2924; }
.home-btn:hover { background: #ede8df; }

.topbar-center { flex: 1; max-width: 400px; }
.search-box { display: flex; border: 1px solid #ddd2c2; border-radius: 8px; overflow: hidden; }
.search-box input { flex: 1; border: none; padding: 8px 12px; font-size: 13px; outline: none; background: #faf7f2; }
.search-box input:focus { background: #fff; }
.search-box button { border: none; background: #faf7f2; padding: 8px 12px; cursor: pointer; font-size: 14px; }

.topbar-right { display: flex; gap: 12px; margin-left: auto; }
.stat-item { font-size: 12px; color: #766f66; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.12s; }
.stat-item:hover { background: #f0ece4; }
.stat-item strong { color: #2d2924; }

/* ===== Main Layout ===== */
#main-layout {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Left Sidebar ===== */
#sidebar-left {
  width: 200px;
  padding: 16px;
  border-right: 1px solid #e0d6c8;
  background: #faf7f2;
  flex-shrink: 0;
}

.sidebar-section { margin-bottom: 20px; }
.sidebar-section h3 { font-size: 12px; color: #a39688; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

#category-list { list-style: none; }
#category-list li {
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #2d2924;
  transition: background 0.12s;
}
#category-list li:hover { background: #ede8df; }
#category-list li.active { background: #2d2924; color: #fff; }

#sort-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd2c2;
  border-radius: 6px;
  font-size: 13px;
  background: #fffdf8;
  color: #2d2924;
}

/* ===== Content Flow ===== */
#content-flow {
  flex: 1;
  padding: 20px;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}

#content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
#view-title { font-size: 16px; font-weight: 600; color: #2d2924; }
#result-count { font-size: 13px; color: #a39688; }

#article-list { display: flex; flex-direction: column; gap: 12px; }
.loading, .empty-state { text-align: center; padding: 40px; color: #a39688; font-size: 14px; }
.error-state { text-align: center; padding: 40px; color: #dc2626; font-size: 14px; }

/* ===== Article Card ===== */
.article-card {
  background: #fffdf8;
  border: 1px solid #e0d6c8;
  border-radius: 10px;
  padding: 16px 20px;
  transition: box-shadow 0.15s;
}
.article-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #2d2924;
  text-decoration: none;
  line-height: 1.4;
}
.card-title:hover { color: #c2410c; }

.card-meta { display: flex; gap: 8px; font-size: 11px; color: #a39688; margin-top: 2px; }

.card-agent-reason {
  font-size: 12px;
  color: #766f66;
  background: #f4f0ea;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 8px;
}

.card-summary { font-size: 13px; color: #5a524a; margin-top: 8px; line-height: 1.5; }

.card-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.card-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #ede8df;
  border-radius: 4px;
  color: #766f66;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0ece4;
}

.card-score {
  font-size: 13px;
  font-weight: 600;
  color: #2d2924;
}
.card-score .score-value.refining { color: #c2410c; }
.card-score .score-value.deep_review { color: #15803d; }
.card-score .score-value.cooled { color: #6b7280; }

.card-stats { display: flex; gap: 12px; font-size: 12px; color: #a39688; }
.card-stats span { display: flex; align-items: center; gap: 3px; }

.card-actions { display: flex; gap: 6px; }
.card-actions button {
  padding: 4px 10px;
  border: 1px solid #ddd2c2;
  border-radius: 6px;
  background: #faf7f2;
  font-size: 12px;
  cursor: pointer;
  color: #2d2924;
  transition: all 0.12s;
}
.card-actions button:hover { background: #ede8df; border-color: #bbb0a0; }
.btn-refine { color: #15803d !important; border-color: #15803d !important; }
.btn-refine:hover { background: #dff0df !important; }
.btn-suppress { color: #dc2626 !important; border-color: #dc2626 !important; }
.btn-suppress:hover { background: #fce4e4 !important; }
.btn-detail { color: #c2410c !important; }

/* ===== Right Sidebar ===== */
#sidebar-right {
  width: 240px;
  padding: 16px;
  border-left: 1px solid #e0d6c8;
  background: #faf7f2;
  flex-shrink: 0;
}

.profile-section { margin-bottom: 20px; }
.profile-section h3 { font-size: 12px; color: #2d2924; margin-bottom: 8px; font-weight: 600; }
.profile-section ul { list-style: none; }
.profile-section li { font-size: 12px; color: #766f66; padding: 4px 0; border-bottom: 1px solid #ede8df; }
.profile-section li:last-child { border-bottom: none; }
.profile-section .weight { color: #2d2924; font-weight: 600; }
.profile-section .weight.pos { color: #15803d; }
.profile-section .weight.neg { color: #dc2626; }

/* ===== Sidebar Toggle ===== */
#sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid #ddd2c2;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 18px;
  cursor: pointer;
  color: #2d2924;
  line-height: 1;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  #sidebar-right { display: none; }
}
@media (max-width: 768px) {
  #sidebar-toggle { display: block; }
  #sidebar-left {
    position: fixed;
    top: 0;
    left: -220px;
    width: 220px;
    height: 100vh;
    z-index: 200;
    border-right: 1px solid #e0d6c8;
    box-shadow: 4px 0 12px rgba(0,0,0,0.1);
    transition: left 0.25s ease;
    overflow-y: auto;
  }
  #sidebar-left.open { left: 0; }
  #sidebar-left.open + #content-flow { margin-left: 0; }

  #main-layout { position: relative; }
  #content-flow {
    max-height: none;
    padding: 12px;
  }
  #topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar-center { order: 3; max-width: 100%; width: 100%; }
  .topbar-right { margin-left: 0; gap: 4px; }
  .stat-item { font-size: 10px; padding: 2px 4px; }
  .logo { font-size: 15px; }
  .logo-sub { display: none; }
  .article-card { padding: 12px 14px; }
  .card-actions { flex-wrap: wrap; }
  .card-footer { flex-wrap: wrap; gap: 8px; }
  .card-stats { order: 3; width: 100%; }
}
@media (max-width: 480px) {
  .stat-item { font-size: 11px; padding: 2px 6px; }
  .stat-item strong { display: inline; font-size: 12px; }
  .topbar-right { gap: 4px; }
}

/* ===== Inline Card Edit Areas ===== */
.card-inline {
  margin-top: 4px;
  padding: 8px;
  background: #f4f0ea;
  border-radius: 6px;
}
.card-inline textarea,
.card-inline input {
  font-family: inherit;
}
