/* ==========================================
   Stats Cards
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card .stat-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}


/* ==========================================
   Velocity Chart
   ========================================== */
.chart-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.chart-container h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}


/* ==========================================
   Activity Timeline
   ========================================== */
.activity-timeline {
  max-height: 400px;
  overflow-y: auto;
  padding-left: 4px;
}

.timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin-left: 8px;
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -11px;
  top: 10px;
  font-size: 12px;
  background: var(--bg-secondary);
  padding: 1px;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-header {
  font-size: 13px;
  color: var(--text-secondary);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

.timeline-change {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 3px;
}

.timeline-old {
  color: var(--accent-red);
  text-decoration: line-through;
}

.timeline-arrow {
  color: var(--text-muted);
}

.timeline-new {
  color: var(--accent-green);
  font-weight: 500;
}


/* ==========================================
   Stats Summary Bar
   ========================================== */
.stats-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  min-width: 70px;
}

.stat-chip .stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-chip .stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-chip.stat-green { background: rgba(34, 197, 94, 0.1); }
.stat-chip.stat-green .stat-value { color: var(--accent-green); }
.stat-chip.stat-blue { background: rgba(59, 130, 246, 0.1); }
.stat-chip.stat-blue .stat-value { color: var(--accent-blue); }
.stat-chip.stat-yellow { background: rgba(234, 179, 8, 0.1); }
.stat-chip.stat-yellow .stat-value { color: #EAB308; }
.stat-chip.stat-purple { background: rgba(168, 85, 247, 0.1); }
.stat-chip.stat-purple .stat-value { color: #A855F7; }


/* ==========================================
   My Stories Widget (Dashboard)
   ========================================== */
.my-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.my-story-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
}

.my-story-item:hover {
  background: var(--bg-tertiary);
}

.my-story-id {
  font-family: monospace;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.my-story-title {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}


/* ==========================================
   Chart Container
   ========================================== */
.chart-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.chart-container h3 {
  margin-bottom: 12px;
}

.chart-wrapper {
  position: relative;
  height: 280px;
}

.chart-wrapper canvas {
  max-height: 280px;
}


/* ==========================================
   Data Table (general)
   ========================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:hover td {
  background: var(--bg-tertiary);
}


/* ========== Priority Matrix ========== */
.priority-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 300px;
}
.matrix-quadrant {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.matrix-urgent_high { background: rgba(248, 113, 113, 0.05); border-color: rgba(248, 113, 113, 0.3); }
.matrix-urgent_low { background: rgba(251, 191, 36, 0.05); border-color: rgba(251, 191, 36, 0.3); }
.matrix-not_urgent_high { background: rgba(59, 130, 246, 0.05); border-color: rgba(59, 130, 246, 0.3); }
.matrix-not_urgent_low { background: rgba(148, 163, 184, 0.05); }
.matrix-quadrant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}
.matrix-count {
  font-size: 11px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--text-muted);
}
.matrix-quadrant-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.matrix-stories {
  flex: 1;
  overflow-y: auto;
  max-height: 200px;
}
.matrix-story {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.matrix-story:hover {
  background: var(--bg-tertiary);
}


/* ========== Recent Changes ========== */
.recent-change-story {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-change-story:last-child {
  border-bottom: none;
}
.recent-change-story a {
  color: var(--accent-blue);
  text-decoration: none;
  font-family: monospace;
}


/* Dashboard toolbar */
.dashboard-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dash-action-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  border-radius: 6px;
  cursor: grab;
  transition: all 0.15s;
  white-space: nowrap;
}
.dash-action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.dash-action-btn:active {
  cursor: grabbing;
}
.dash-action-btn.dragging {
  opacity: 0.4;
}
.dash-action-btn.drag-over {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}


/* ==========================================
   Achievement Badges
   ========================================== */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.achievement-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  cursor: default;
}

.achievement-unlocked {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(59, 130, 246, 0.08));
  border-color: rgba(124, 58, 237, 0.3);
}

.achievement-unlocked:hover {
  border-color: rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.achievement-locked {
  background: var(--bg-secondary);
  opacity: 0.45;
  filter: grayscale(0.8);
}

.achievement-locked:hover {
  opacity: 0.65;
  filter: grayscale(0.4);
}

.achievement-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.achievement-info {
  flex: 1;
  min-width: 0;
}

.achievement-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.2;
}

.achievement-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.3;
}

.achievement-progress {
  font-size: 10px;
  color: var(--accent-blue);
  margin-top: 2px;
  font-weight: 500;
}
