:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-sidebar: #0a0e13;
  --border: #21262d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #6366F1;
  --accent2: #8B5CF6;
  --green: #10B981;
  --red: #EF4444;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.3);
  --font: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg-dark); color: var(--text); display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; min-width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0; position: fixed; height: 100vh; z-index: 100;
}
.sidebar-top { padding: 0 16px 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { width: 36px; height: 36px; }
.brand-text { font-size: 20px; font-weight: 700; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  border: none; background: none; color: var(--text-dim); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s; font-family: var(--font);
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--bg-card); color: var(--accent); }
.sidebar-bottom { padding: 16px; border-top: 1px solid var(--border); margin-top: 8px; }
.status-badge { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.pulse { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Main Content */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: rgba(13,17,23,.92); backdrop-filter: blur(12px); z-index: 50;
}
.topbar-search {
  display: flex; align-items: center; gap: 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 16px; width: 360px;
}
.topbar-search svg { color: var(--text-dim); flex-shrink: 0; }
.topbar-search input {
  background: none; border: none; color: var(--text); font-size: 14px;
  width: 100%; outline: none; font-family: var(--font);
}
.topbar-search input::placeholder { color: var(--text-dim); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: var(--text-dim); cursor: pointer; display: flex; }
.btn-icon:hover { background: var(--bg-card); color: var(--text); }
.badge-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; position: absolute; top: -2px; right: -2px; }
.notif-btn { position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }

/* Pages */
.page-wrapper { padding: 32px; flex: 1; }
.page { animation: fadeIn .3s ease; }
.page.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Hero */
.hero-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1030 100%);
  border: 1px solid var(--border); border-radius: 16px; padding: 40px 48px; margin-bottom: 24px;
}
.hero-title { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.accent { color: var(--accent); }
.hero-subtitle { font-size: 16px; color: var(--text-dim); max-width: 480px; line-height: 1.6; }
.hero-visual { position: relative; width: 120px; height: 120px; }
.glow-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.3), transparent 70%);
}
.ring-2 { inset: -20px; opacity: .3; }
.icon-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 48px; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  display: flex; align-items: center; gap: 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { font-size: 24px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 15%, transparent); border-radius: 10px; }
.stat-info { display: flex; flex-direction: column; }
.stat-num { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Section Titles */
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.section-title-flex { display: flex; align-items: center; justify-content: space-between; }
.mt-16 { margin-top: 16px; }

/* Cards Grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: all .2s; cursor: pointer; display: flex; flex-direction: column; gap: 12px;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99,102,241,.1); }
.card-tag { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.card-title { font-size: 16px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }

/* Feed List */
.feed-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.feed-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--bg-card);
  cursor: pointer; transition: all .2s;
}
.feed-item:hover { background: #1d2330; }
.feed-item-rank { font-size: 18px; font-weight: 700; color: var(--text-dim); min-width: 28px; text-align: center; }
.feed-item-rank.hot { color: var(--accent); }
.feed-item-content { flex: 1; }
.feed-item-title { font-size: 14px; font-weight: 500; }
.feed-item-source { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.feed-item-time { font-size: 12px; color: var(--text-dim); }

/* Daily */
.daily-header { margin-bottom: 24px; }
.daily-date { font-size: 14px; color: var(--text-dim); margin-bottom: 4px; }
.daily-summary { font-size: 14px; color: var(--text-dim); line-height: 1.6; }
.daily-articles { display: flex; flex-direction: column; gap: 12px; }
.daily-article {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.daily-article h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.daily-article p { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* Trending */
.trending-topics { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.trend-tag {
  padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px;
  transition: all .2s;
}
.trend-tag:hover { border-color: var(--accent); }
.trend-rank { color: var(--accent); font-weight: 700; }

/* Resources */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.resource-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 10px; transition: all .2s;
}
.resource-card:hover { border-color: var(--accent); }
.resource-icon { font-size: 32px; }
.resource-name { font-size: 16px; font-weight: 600; }
.resource-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.resource-link { font-size: 13px; color: var(--accent); text-decoration: none; margin-top: 4px; }
.resource-link:hover { text-decoration: underline; }

/* Load More */
.load-more {
  display: block; margin: 24px auto 0; padding: 10px 32px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px;
  font-weight: 500; cursor: pointer; font-family: var(--font); transition: all .2s;
}
.load-more:hover { background: #1d2330; border-color: var(--accent); }

/* Chat Widget */
.chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 200; }
.chat-toggle-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent); border: none;
  color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(99,102,241,.4); transition: transform .2s;
}
.chat-toggle-btn:hover { transform: scale(1.1); }
.chat-panel {
  position: absolute; bottom: 60px; right: 0; width: 380px; height: 520px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel.hidden { display: none; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar);
}
.chat-title-area { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.chat-close-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 18px; }
.chat-close-btn:hover { color: var(--text); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.msg-bot { background: #1d2330; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-user { background: var(--accent); align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input-area { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-area input { flex: 1; background: #1d2330; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; color: var(--text); font-size: 13px; outline: none; font-family: var(--font); }
.chat-send-btn { width: 40px; background: var(--accent); border: none; border-radius: 8px; color: white; font-size: 16px; cursor: pointer; }
.chat-send-btn:hover { opacity: .9; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar-search { width: 100%; }
  .page-wrapper { padding: 16px; }
  .hero-banner { flex-direction: column; text-align: center; padding: 32px 24px; }
  .hero-title { font-size: 24px; }
  .chat-panel { width: calc(100vw - 48px); right: -12px; }
}
