/* ===== DASHBOARD LAYOUT ===== */
.dash-body { background: var(--gray-100); overflow: hidden; height: 100vh; }

.dash-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-200);
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--gray-600);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.sidebar-item:hover { background: var(--gray-100); color: var(--black); }
.sidebar-item.active {
  background: var(--black);
  color: var(--white);
}

.sidebar-icon { font-size: 1rem; }

.sidebar-section {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}

.sidebar-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 10px;
}

.quick-links { display: flex; flex-direction: column; gap: 4px; }

.quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 5px;
  font-size: 0.82rem;
  color: var(--gray-600);
  transition: background 0.15s, color 0.15s;
}
.quick-link:hover { background: var(--gray-100); color: var(--black); }
.quick-link span { font-size: 0.85rem; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
}

.sidebar-back {
  font-size: 0.82rem;
  color: var(--gray-400);
  transition: color 0.2s;
}
.sidebar-back:hover { color: var(--black); }

/* ===== DASH MAIN ===== */
.dash-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 32px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.dash-title {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-subtitle { font-size: 0.85rem; color: var(--gray-400); }

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--gray-600);
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-refresh:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--black); }

#refreshIcon { display: inline-block; transition: transform 0.5s; }
#refreshIcon.spinning { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== STATES ===== */
.loading-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex: 1;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.hidden { display: none !important; }

/* ===== FEED GRID ===== */
.feed-grid {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-content: start;
}

/* ===== ARTICLE CARD ===== */
.article-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.article-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--gray-100);
}

.article-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--gray-300);
}

.article-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.article-source {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.article-date { font-size: 0.75rem; color: var(--gray-400); }
.article-dot { color: var(--gray-300); font-size: 0.75rem; }

.article-title {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 8px;
  color: var(--black);
}

.article-desc {
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--black);
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 1px;
  transition: border-color 0.2s;
}
.article-link:hover { border-color: var(--black); }

/* ===== CATEGORY BADGE ===== */
.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-left: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .feed-grid { grid-template-columns: 1fr; padding: 16px; }
  .dash-header { padding: 20px 16px; }
}

/* ===== SIDEBAR DIVIDER ===== */
.sidebar-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 8px 16px;
}

/* ===== PANEL WRAPPER ===== */
.panel-wrap {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* ===== REPORT HEADER ===== */
.report-header, .monitor-header {
  margin-bottom: 20px;
}
.report-meta {
  font-size: 0.78rem;
  color: var(--gray-400);
}
.report-section {
  margin-bottom: 32px;
}
.report-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

/* ===== CLUSTER CARD ===== */
.cluster-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.cluster-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.cluster-kw {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--black);
}
.cluster-score {
  font-size: 0.75rem;
  color: var(--gray-400);
  flex-shrink: 0;
}
.cluster-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-600);
}
.tag-mover {
  background: #fef3c7;
  color: #92400e;
}
.cluster-affinity {
  font-size: 0.78rem;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.cluster-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.cluster-item {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 0.8rem;
  color: var(--gray-700);
  transition: background 0.15s;
  text-decoration: none;
}
.cluster-item:hover { background: var(--gray-100); color: var(--black); }
.cluster-item-source {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cluster-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cluster-item-date {
  font-size: 0.72rem;
  color: var(--gray-400);
  text-align: right;
}

/* ===== TASK MONITOR ===== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: 16px;
}
.task-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.task-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--black);
}
.task-schedule {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 2px;
}
.task-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.task-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.metric {
  font-size: 0.75rem;
  color: var(--gray-600);
}
.task-last-run {
  font-size: 0.72rem;
  color: var(--gray-400);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green  { background: #22c55e; }
.dot-red    { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-gray   { background: var(--gray-300); }
