/* Parse Intelligence Workbench */
.pi-workbench {
  --pi-accent: #00e5ff;
  --pi-gold: #ffd700;
  --pi-purple: #a855f7;
  --pi-bg: rgba(6, 10, 18, 0.92);
  border-radius: 16px;
  border: 1px solid rgba(0, 229, 255, 0.12);
  background: linear-gradient(165deg, rgba(8, 12, 22, 0.98) 0%, rgba(12, 18, 32, 0.95) 100%);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}

.pi-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.06) 0%, transparent 60%);
}

.pi-header h2 {
  margin: 0;
  font-size: 1.15rem;
  background: linear-gradient(90deg, #f1f5f9, #00e5ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pi-header-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.pi-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

@media (max-width: 900px) {
  .pi-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

.pi-kpi-cell {
  padding: 0.85rem 1rem;
  border-right: 1px solid rgba(148, 163, 184, 0.08);
  transition: background 0.2s;
}

.pi-kpi-cell:hover { background: rgba(0, 229, 255, 0.04); }
.pi-kpi-cell:last-child { border-right: none; }
.pi-kpi-cell .lbl { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.pi-kpi-cell .val { font-size: 1.4rem; font-weight: 800; color: #f8fafc; line-height: 1.2; }
.pi-kpi-cell .sub { font-size: 0.68rem; color: #475569; margin-top: 0.1rem; }

.pi-body {
  display: grid;
  grid-template-columns: 260px 1fr 380px;
  min-height: 520px;
}

@media (max-width: 1200px) {
  .pi-body { grid-template-columns: 240px 1fr; }
  .pi-detail { display: none; }
  .pi-body.detail-open .pi-detail { display: flex; grid-column: 1 / -1; border-top: 1px solid rgba(148, 163, 184, 0.12); }
}

.pi-filters {
  padding: 1rem;
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  max-height: 720px;
}

.pi-filters label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin: 0.85rem 0 0.35rem;
  font-weight: 700;
}

.pi-filters label:first-child { margin-top: 0; }

.pi-search {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #f1f5f9;
  font-size: 0.85rem;
}

.pi-search:focus {
  outline: none;
  border-color: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.12);
}

.pi-select, .pi-range {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  font-size: 0.82rem;
}

.pi-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #cbd5e1;
  margin: 0.45rem 0;
  cursor: pointer;
}

.pi-toggle-row input { accent-color: #00e5ff; }

.pi-filter-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }

.pi-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.35);
  color: #7dd3fc;
  cursor: pointer;
}

.pi-filter-chip button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 0.9rem;
}

.pi-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.pi-trends-bar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: rgba(168, 85, 247, 0.04);
}

.pi-trends-bar .lbl {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pi-hype-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.pi-hype-chip {
  font-size: 0.76rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.1);
  color: #e9d5ff;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  user-select: none;
}

.pi-hype-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2); }
.pi-hype-chip.active {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.15);
  color: #a5f3fc;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.pi-hype-chip.cross {
  border-color: rgba(255, 215, 0, 0.45);
  background: rgba(255, 215, 0, 0.08);
  color: #fde68a;
}

.pi-hype-chip .sc { opacity: 0.6; font-size: 0.62rem; margin-left: 0.2rem; }

.pi-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.pi-toolbar .count {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-right: auto;
}

.pi-toolbar .count strong { color: #00e5ff; }

.pi-sort-btn {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.pi-sort-btn.active {
  border-color: rgba(0, 229, 255, 0.45);
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.08);
}

.pi-view-toggle { display: flex; border-radius: 8px; overflow: hidden; border: 1px solid rgba(148, 163, 184, 0.2); }

.pi-view-toggle button {
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.pi-view-toggle button.active { background: rgba(0, 229, 255, 0.12); color: #00e5ff; }

.pi-table-wrap {
  flex: 1;
  overflow: auto;
  max-height: 420px;
}

.pi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.pi-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 0.55rem 0.75rem;
  background: rgba(10, 15, 25, 0.98);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  color: #64748b;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.pi-table th:hover { color: #00e5ff; }

.pi-table th .arrow { margin-left: 0.25rem; opacity: 0.7; }

.pi-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  vertical-align: middle;
  color: #e2e8f0;
}

.pi-table tr { cursor: pointer; transition: background 0.12s; }

.pi-table tbody tr:hover { background: rgba(0, 229, 255, 0.05); }

.pi-table tbody tr.selected {
  background: rgba(0, 229, 255, 0.1);
  box-shadow: inset 3px 0 0 #00e5ff;
}

.pi-table .site-cell { color: #7dd3fc; font-weight: 600; font-size: 0.75rem; }
.pi-table .title-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-table .num { font-variant-numeric: tabular-nums; text-align: right; }

.pi-badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.pi-badge.changed { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.pi-badge.hype-high { background: rgba(168, 85, 247, 0.25); color: #e9d5ff; }

.pi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  max-height: 420px;
}

.pi-card {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(7, 11, 18, 0.8);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.pi-card:hover { border-color: rgba(0, 229, 255, 0.35); transform: translateY(-1px); }
.pi-card.selected { border-color: #00e5ff; box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.2); }

.pi-detail {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(0, 0, 0, 0.25);
  min-width: 0;
}

.pi-detail-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: #475569;
  font-size: 0.85rem;
}

.pi-detail-head {
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.pi-detail-head h3 { margin: 0 0 0.35rem; font-size: 0.95rem; color: #f1f5f9; line-height: 1.35; }

.pi-detail-meta { font-size: 0.72rem; color: #64748b; }

.pi-detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.pi-detail-tabs button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.pi-detail-tabs button.active {
  color: #00e5ff;
  border-bottom-color: #00e5ff;
  background: rgba(0, 229, 255, 0.05);
}

.pi-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  max-height: 480px;
}

.pi-read-text {
  white-space: pre-wrap;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.pi-read-text mark {
  background: rgba(255, 215, 0, 0.35);
  color: #fef9c3;
  padding: 0 0.15rem;
  border-radius: 2px;
}

.pi-link-list { list-style: none; padding: 0; margin: 0; }

.pi-link-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
  font-size: 0.78rem;
}

.pi-link-list a { color: #86efac; word-break: break-all; }

.pi-heading-list { display: flex; flex-direction: column; gap: 0.35rem; }

.pi-heading-item {
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.06);
  border-left: 3px solid rgba(0, 229, 255, 0.4);
  color: #e2e8f0;
}

.pi-loading {
  padding: 2rem;
  text-align: center;
  color: #64748b;
}

.pi-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #64748b;
}

.pi-empty strong { display: block; color: #94a3b8; margin-bottom: 0.35rem; }
